That code should work. I just tested in my own index.php and it worked. Are you sure you’re looking at the index.php file. Sometimes WP actually pulls a different template: For more info, see WP template hierarchy diagram. To test what template you’re seeing, place this code in your functions.php file temporarily:
add_action('wp_head', 'show_template');
function show_template() {
global $template;
echo '<span style="color: #000; z-index: 10000; position: absolute;">' . $template . '</span>';
}
Related Posts:
- How to use “Add link” pop up for a WordPress widget
- How to get all posts related to particular category name?
- Add tag to post api wordpress
- Confirmation box when submitting post for review
- Add a new post status in the post progression
- How to add a quicklink to the Posts Admin Published|Scheduled|Trash menu
- How to show list of posts by author and category?
- Getting the Next and Previous Posts Titles in the Sidebar?
- How to control which category will be picked for the slug of a post?
- How to hide the Text Area in the Post Edit screen
- upload image in a meta box
- Search posts by post author name
- Why is our post editor stuck at cols=40?
- Adding a Nav menu to post admin
- how to limit and display tag?
- Insert custom div between posts
- How to Display Post View Count
- Adding Multiple Values to a Post Meta Key
- Warning: Creating default object from empty value in … /post.php
- get custom image size
- Does an article (post) id ever change?
- Display page content AFTER a loop of posts
- How to get the date of a post in WordPress, so I could use it in a script?
- Check is_single() outside loop
- Only display a certain number of posts, dependent on how many posts there are available in a query
- how to replace embedded “full” sized images within a post with the “large” ones
- Downgrade user from role that allows post creation
- Change default Posts page
- Batch process: remove first image from post content
- Create post for every user?
- Facebook Share Thumbnail
- Yearly archive page for future year
- How blog page in WordPress works : blog page retrieve first post ID
- Delete WordPress posts from URL list sql query
- Posts with multiple authors with different roles
- How to get the user meta data for a post?
- Custom WordPress Theme: Publish Date and Display Date for posts right beside each other
- How to change permalink on post click on post listing page
- Auto insert More tags in all posts
- Blog post per page setting conflicting with custom WP_Query?
- Show certain posts in a LIST format that members have been granted access to
- WordPress Rest API Create Post
- How to get next post ID?
- performance of post_exists
- Add a custom meta box in the post options that loads some html code in the header
- Display an author’s posts on his own author page
- Use two different post_per_page limits with infinite scroll
- A/B testing of posts with unique URLs for each variant AND editing in custom fields
- How to dynamically parse and transform post/page content before displaying it?
- getting “Object of class WP_Post could not be converted to string” – when it is a string
- How to get posts published on the latest date?
- Using setup_postdata() with multi-dimensional array
- Bolding several words at once
- Post Form Results to Table in Same page
- Post Title to featured Image ALT
- I don’t want the complete article to show on homepage
- wp_query if have posts show date but not in loop
- Get posts from current category?
- Send email to admin with post author
- posts going to 2 pages/categories only show up in 1
- How do I get the image that is submitted with a post, when I’m in the loop?
- How to output all taxonomy links from a custom post type in a menu?
- Cannot create new posts or upload images using media manager
- How can i showcase all my galleries?
- Rewrite image links from attachment id to attachment link
- How do I change the template specifically for single posts?
- wp-insert-post execute from server?
- Change the size of the featured image for post?
- Send email to user when I publish a new post
- Pagination Stops
- Change URL of previous posts and next posts link in WordPress
- Remove status ‘archived’ from the default post and page view
- Limit amount of categories displayed in a post
- Custom Post Types and Broken Permalinks
- I lost the link to my posts in my menu bar
- Allow registering user to select post category when signing up to blog
- how to call recent post content in a loop ( only the content before read more tag)
- How do I use slideToggle inside a wordpress post?
- Display author bio box
- Bulk posts from DRAFT Section
- How can I filter the post of a CPT by taxonomy Term in admin meta-box dropdown?
- How to make post button to a random post
- Where is object, property or label in the database that controls the order of the posts being displayed?
- Is there a way to change the complete URL of the blog post for a redirecting tracking link?
- WordPress with static posts page and custom permalink structure doesn’t find posts with numeric permalinks
- My posts section for logged in user
- How to get single post by one author?
- Latest posts on all pages
- Getting 404 when using rewrite rule for posts
- Posts and pages not getting published
- How to create a post based on data in a table?
- Display all posts from selected month
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- Permalink remain the same on each page
- Displaying warning if no featured image has been set – Post Editor
- How to highlight most recent posts in a list
- wordpress show category link instead of post link [closed]
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- How to get post ID after removing that post?
- I cannot see the pagination in /wp-admin posts page