• 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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey,
    You’ll notice the 'orderby' => 'parent' which is not necessarily alphabetical but instead works by pulling the category that is the “deepest” child. So if you want to make one category that one you want to show simply make it a child of a new or other category.

    I hope that helps,

    Kadence Themes

    Thread Starter hugodebe

    (@hugodebe)

    Thanks for your quick reply. I get it. But in my case this solution has a cons, as I would like to treat all the ‘sold’ product into the same category. The fact to have many child categories for ‘sold’ makes it a bit more complicated…

    Do you know if there is a way to call the ‘principal’ parent category name? I didn’t find anything about such parameter.

    Please explain what you mean by “principal”.

    You can make the sold a child even if it has children.

    Kadence Theme

    Thread Starter hugodebe

    (@hugodebe)

    By ‘principal’ I mean “primary”, sorry.

    When you apply a second category to a post, there is an option to “Make primary” the one you want.

    Thread Starter hugodebe

    (@hugodebe)

    The “make primary” function is not a wp one, it’s from yoast seo isn’t it?

    Thread Starter hugodebe

    (@hugodebe)

    Ok, as a quick solution I followed your advice and created a new parent category, with the objective to turn my ‘sold’ category a child of it. It works well. The Blog Post Head Title is now the ‘sold’ child category name as expected.

    The only cons is the url. It became a bit longer and confusing, as it contains now the parent slug.

    Other suggestions are welcome :

    – How to call a specific parent category name when there is more than one parent category for a single post?

    I let the thread open for now, ok?

    Well it goes by depth so if you make a child of a child then your making that one more important.

    Kadence Themes

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Blog Post Head Title must be the principal category if there is more than one’ is closed to new replies.