Custom Post Type Specific Post Template

For some reason wordpress don’t honor Template_Hierarchy. The best way to get around this problem is to “force” wordpress to use the custom single.php template that you created. To accomplish that, add the following function underneath your CPT. /* Information Posts Template selection – a single.php just for our wrestler_profiles */ function pietergoosen_info_template_include( $original_template ) … Read more

Use page template for custom $_GET content

You can use the template_include filter to load a template file from your theme: add_filter( ‘template_include’, ‘my_page_template’, 99 ); function my_page_template( $template ) { if ( isset( $_GET[‘info’] ) && $_GET[‘info’] == ‘some_value’ ) { $new_template = locate_template( array(‘my-template.php’ ) ); if ( ” != $new_template ) { return $new_template ; } } return $template; … Read more

How to create Page templates for showing Blog posts in different layouts?

I wouldn’t use custom page templates merely for changing the layout of the blog posts index. Using page templates for the blog posts index bypasses the core handling for display of the blog posts index (which per the template hierarchy uses either home.php or index.php to render). Edit I never…said that I want to change … Read more

Widgets not showing on sidebars

You’ve registered your sidebars with the ids of sidebar-left and sidebar-right but you are are attempting to display them using only left and right. You need to use the correct ids. That is: dynamic_sidebar( ‘sidebar-left’ ); You need that id with both dynamic_sidebar() and is_active_sidebar() if ( is_active_sidebar( ‘sidebar-left’ ) ) { dynamic_sidebar( ‘sidebar-left’ ); … Read more

Ajax Call in page theme not working?

You shouldn’t be including jQuery explicitly. WP ships with a copy and multiple copies tend to mess things up. See wp_enqueue_script(). You shouldn’t be trying to load PHP file inside a theme directly. It won’t load WordPress environment that way (unless it tries to do so explicitly, which is usually very fragile and pretty much … Read more