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

Newest comments first not working

You have no need callback function. Only reverse_top_level: true is find for what you want to do. Just remove ‘callback’ => ‘custom_comments_callback’, from your array. <?php wp_list_comments(array( ‘reverse_top_level’ => true, ‘avatar_size’ => 50, ‘reply_text’ => ‘Reply to this comment’ )); ?>

single- and archive- templates not being applied to custom post types, not even after flushing permalinks

Answering my own question here, for anyone who might encounter this problem in the future. The cause for the right templates not loading was having uppercase letters in my template filename. Changing all characters in the filename to lowercase resolved the problem, and the templates are now being applied as they should. I’m still unsure … Read more

Display content on Single page

Unless you have generated metafields called ‘home’, ‘about’, ‘contact’ and ‘services’ in functions.php using add_post_meta your calls to get_post_meta will always return false. So if you test if they are true later on, the answer is ‘no’ and nothing will be displayed.

Include template if a post is a single product

As Andy mentioned, you’re calling WCS_DIR, but that doesn’t exist. Updated the code to call WCT_DIR instead: define( ‘WCT_DIR’, plugin_dir_path( __FILE__ ) ); add_filter( ‘template_include’, ‘wdm_load_template’, 99 ); function wdm_load_template( $template ) { $template_slug = basename( rtrim( $template, ‘.php’ ) ); if ( ($template_slug === ‘single-product’ || $template_slug === ‘woocommerce’) && is_product() ) { $template … Read more

Add point on excerpt post

First of all return is used in PHP to return a value from a function. If you want to display something you need echo. Second, no excerpt is displayed in the lines you are pointing to. The excerpt is retrieved and then stored in a variable $myExcerpt. If you want to add … to the … 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”; }