posts not showing on index.php

The template naming is a bit confusing in this situation, but what is happening is normal behavior in the Template Hierarchy. home.php shows your posts page, whether it’s on the front page, or assigned to another page when using a static front page. If you want your home.php template to be used for your static … Read more

Two exact templates, sidebar showing in one but not the other

Look at the config.php: function roots_display_sidebar() { $sidebar_config = new Roots_Sidebar( /** * Conditional tag checks (http://codex.wordpress.org/Conditional_Tags) * Any of these conditional tags that return true won’t show the sidebar */ array( ‘is_404’, ‘is_front_page’ ), /** * Page template checks (via is_page_template()) * Any of these page templates that return true won’t show the sidebar … Read more

How can I use a file in my plugin as a replacement for single.php on custom-post-type query?

The way I handle these is to store to use template_include to conditionally pass my plug-in template. One of these conditions is that the corresponding file hasn’t already been found by WordPress (i.e. isn’t present in the theme folder). This means that users can over-ride the plug-in template with a theme-specific one by simply creating … Read more

Create a Blog Template Page

Why reinvent the wheel? Just create archive-{posttype}.php, and ensure that ‘has_archive’ is set to true for the post type. If your post type is event: archive-event.php. Then, WordPress will handle the query automatically. If pretty permalinks are enabled: example.com/{posttype} …will display the archive index page for {posttype}.

Set templates for custom post types

If your theme and plugins follow the basic WP template hierarchy and different content types actually have their own custom post types, you should be able to achieve this through template naming. Learn more from http://codex.wordpress.org/Post_Type_Templates and http://codex.wordpress.org/Template_Hierarchy Unfortunately many plugins (and some themes too) have their own template structure and this might cause problems. … Read more