I have a page marked as the Posts page that lists most recent blog posts.
I am looking for a way to test if a post is a custom post type. For example, in, say, the sidebar I can put in code like this:
What is the idea way to register/enqueue scripts and/or styles for use in plugins?
I have added a small custom function to display a little author bio blurb at the bottom of each blog entry in my functions.php file inside the current theme that I am using. So far so good, it is working great but I noticed that this function is being applied to every page, for example it is showing up at the bottom of my “Contact” page.
I needed a way to filter a page/posts content before it was loaded so I could add scripts to the header if a specific shortcode was present. After much searching I came across this on http://wpengineer.com
I have page called “Apple”, the page’s ID id 2533.
This is the code im using in my functions file:
As far as I know, there’s not a simple function that will return true if a post has an attachment. With that in mind, what’s the best way to determine if a post has an attachment (or even better, has an image attachment)? I’m automatically inserting a shortcode on posts, but would like that to only happen if there is actually an image attached to the post.
The function below is used to show certain content after the first paragraph. I would like to show ‘content X’ after the 1st paragraph and ‘content Y’ after 2nd paragraph.
Before I get started, I want to acknowledge that there are some really good articles that are targeted at how to conditionally enqueue scripts based on page/post content.