We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Configuration

Change site's logo on post.php depending on witch category is selected on post.h...

On post.php I have header's <h1>Site Title</h1> and also <?php perch_blog_post(perch_get('s')); ?> on main body.

On post.html template I have created two category sets.:

1) blog's default category set:

<perch:categories id="categories" set="blog" label="Kind" required="true" />

2) Who set:

<perch:categories id="who" set="who" label="Who design it?" required="true" />

I am looking to add a class to header's h1 class="peter" or class="michael" depending on who category is selected. Any idea?

Raul Serrano

Raul Serrano 0 points

  • 2 years ago

You can get the catTitle from within the template via <perch:category id="catTitle" />. You may also be able to use format="LC" to ensure the output is lowercase for use in a HTML class.

Hi Mathew, thanks for answering. That works good with main category set. I am trying to do it with who category. How could I filter it?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you be more specific?

Hi Drew, I using two category sets on blog post:

<perch:categories id="categories" set="blog" label="Kind" required="true" />
<perch:categories id="who" set="who" label="Who design it?" required="true" />

I need to get catTitle from who category set, but is giving me main blogset. How can I get who's set?

<h1<?php perch_blog_post_categories(perch_get('s'), array('template' => 'logo.html',)); ?>>CCRR Architects</h1>

logo.html

 class='<perch:category id="catTitle" format="LC" set="who" />'

From what I know, you will need to access it via the below markup - not the self closing category tag.

<perch:categories id="who" set="who" suppress="true">
    <perch:category id="catTitle" type="text" />
</perch:categories>

You could then have that within the markup for the class=" on your header.

Hi Mathew, it's not getting anything editing logo.html

Sorry, remove the suppress="true"

nothing...

Any idea?

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you're using your own category set, you need to use the standard category functions to access it.