Locating the template behind a WordPress Page

Just an idea – have you tried putting something like this: <?php if ( current_user_can(‘manage_options’) ) { echo get_option(‘current_page_template’); } ?> You may be able to put it in the header so admins can see the template names of every page – although without testing I’m not sure – may have to go in the … Read more

Creating page-templates directory breaks everything!

When a page is assigned to a template, this template selection is saved in the post meta table under the key _wp_page_template. These template values are as follow default if no page template in explicitely set {$template}.php for templates in root subfolder/{$template}.php for templates in a subfolder where subfolder should be the name of the … Read more

Single Post Templates Doubt

They do not differ technically. These files exist in your theme directory and the template that loads is determined by the following: If you have a product with slug of dmc-12, then WordPress will first look for a file called single-product-dmc-12.php in the theme directory. If it finds it it will use that template when … Read more

Remove ” Browse Category : ” from Archive title

If you are using child theme. Add filter in the functions.php of child theme like this. add_filter(‘get_the_archive_title’,’wpse_224884_filter_archive_title’,10,1); function wpse_224884_filter_archive_title($title){ if ( is_category() ) { $title = sprintf( __( ‘%s’, ‘shaped-blog’ ), single_cat_title( ”, false ) ); } return $title; } Or Copy the entire function into functions.php function shaped_blog_archive_title( $before=””, $after=”” ) { if ( … Read more

How can I display a list of pages and the template used by each?

You could try this quick piece of code, it doesnt output to array though. $args = array( ‘meta_key’ => ‘_wp_page_template’, ‘sort_column’ => ‘post_title’, ‘sort_order’ => ‘desc’); $templates = get_pages($args); foreach ( $templates as $template){ $templatePage = $template->meta_value; $templateName = $template->post_name; echo “Named Template: {$templateName} – – {$templatePage}\n”; }

How can I make is_page_template() workable in child theme?

Your first version of no_sidebar_style() looks fine: function no_sidebar_style(){ if (is_page_template(‘page-templates/page-nosidebar.php’)) { wp_enqueue_style( ‘no-sidebar-style’, get_stylesheet_directory_uri().’/css/no-sidebar.css’); } } add_action( ‘wp_enqueue_scripts’, ‘no_sidebar_style’, 19); For debugging, you can use get_page_template() to see the name of the template you’re viewing.