Comment count next to post title?

On most cases you should be able to use the_title filter to modify the title string. Use get_comments_number() to get the comments count for the post – of given ID or the current one. For example, add_filter( ‘the_title’, ‘wpse_427277_the_title’, 10, 2 ); function wpse_427277_the_title( string $title, $post_id = null ): string { $comment_count = (int) … Read more

Changing a page title while the page is being built

It seems that the way you attached your function to the document_title_parts filter is wrong. As per WordPress documentation, document_title_parts only accepts one parameters, array $title. So it doesn’t make sense that when you have 2 parameters in your function. I suggest you do something like this: function custom_document_title( $title_parts ) { // Here is … Read more

Is it possible to remove the “Shop” title from the WooCommerce catalogue? [closed]

CSS METHOD To hide with CSS this should do the trick for you. Add the following to the theme’s or child theme’s style.css, or to the Customizer’s CSS section: body.post-type-archive-product .bs-card-box.page-entry-title { display: none; } What we’re doing here is targeting the product archive template file that WooCommerce uses to dynamically create that page. By … Read more

Split titles by the ” – ” in WordPress

i’ve already solved it, i had to change the $title = get_the_title(); to $title = get_post()->post_title; in the end it looks like that: <?php $title = get_post()->post_title; // Get the title string $parts = explode(‘ – ‘, str_replace(‘–’, ‘-‘, $title)); // Replace em dash with en dash and split the title $artist = trim($parts[0]); // … Read more

How to remove “Category:” title prefix in Twenty Sixteen theme?

That title is coming from archive.php file of TwentySixteen theme. You can find a <header> code section in that file. What you can do, simply copy the archive.php file as category.php and then remove the following code section from category.php file: <header class=”page-header”> <?php the_archive_title( ‘<h1 class=”page-title”>’, ‘</h1>’ ); the_archive_description( ‘<div class=”taxonomy-description”>’, ‘</div>’ ); ?> … Read more

Hide page title on dedicated posts page

With the limited information here, it’s hard to point you in the right direction…so I’ll try my best. Assumptions: You are using the WordPress theme twentytwentythree or newer The best way I’ve found to do this is by going finding the Template and overriding it. To find the default template for Blog posts: Go to … Read more