Blog Post Head Title must be the principal category if there is more than one
-
Hi there, I had a play with the Pinnacle free theme for a blog.
My question is about how to change way the Blog Post Head Title is defined in the theme, when set to Category. In the case there are more than one category, it takes the first one in alphabetical order. Could it be the ‘principal’ one displayed, or any oher parent category of my choice?
I’m working on a website where blog articles are kind of products and when the proudct is sold, I add a second category which is ‘sold’ (“Déjà vendu” in French). It allows me to apply the css styles I want to the the products already sold. As I don’t want to remove the initial category of this product, I considered the use of 2 categories.
I would like the Blog Post Head Title of the Pinnacle theme to display the category I want and NOT the first one in alphabetical order. I need a way to define a new rule for that. It could be the initial category of the product (the ‘principal’ category by defaut) or it could be the ‘sold’ category (the second parent category)…
Here is the website: https://novatradebrasil.com/kombi/
And here, the way it is defined into blog-post-header.php in Pinnacle theme:
if ( $terms = wp_get_post_terms( $post->ID, 'category', array( 'orderby' => 'parent', 'order' => 'DESC' ) ) ) { $cat = $terms[0]; } else { $cat = get_the_category(); $cat = $cat[0]; } $page_title_title = $cat->name;
Suggestions are very welcome. Thanks in advance
- The topic ‘Blog Post Head Title must be the principal category if there is more than one’ is closed to new replies.