wordpress – load a template based on the URI

I assume that your custom post type windows would map onto /windows/ etc? You can customise the template for individual custom post types via single-posttype.php in your theme, e.g. single-windows.php single-doors.php and single-garages.php WordPress will automatically pick these up You could also use custom page templates, e.g. page-windows.php or custom templates with the right template … Read more

How to assign a class to a page with a custom template?

Using is_page(8) will make your code a bit static. Let’s make it dynamic as you’re after with is_page_template(): <?php function prefix_conditional_body_class( $classes ) { if( is_page_template(‘mytemplate.php’) ) $classes[] = ‘mytemplate’; return $classes; } add_filter( ‘body_class’, ‘prefix_conditional_body_class’ ); Worked for me in a child theme with the template file in the root of the child theme, … Read more

Correct process for a new Page Template?

A page template defines the full rendered content displayed: header, footer, content – everything. So, at the very least, you’ll need to call get_header() and get_footer(), or manually add the header and footer code to the template. Also, I would recommend using a callback to enqueue your custom stylesheet. You can use the is_page_template() conditional … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)