Marcio
Marcio

Reputation: 317

Changing logos of site based on class - PHP Wordpress

I have this code in my header.php to change the website's logo based on the page's slug:

$logo_img = 'default'; 
    if (is_page('brookside')) {
        $logo_img = 'brookside'; 
    } elseif (is_page('hilltop')) {
        $logo_img = 'hilltop'; 
    } elseif (is_page('reserve')) {
        $logo_img = 'reserve'; 
    }   

Which works great. However, the pages a need to change the logo are query string URL, so they don't have slugs. I was able to add a unique class to each page. My question is:

How do I translate that code to "if a page has "x" class? So, what function should I use instead of is_page?

Any help would be very appreciated! Thanks!

Upvotes: 0

Views: 58

Answers (2)

Dekel
Dekel

Reputation: 62536

You can use:

if($_GET['ct_additional_features'] == 'brookside') {
    $logo_img = 'brookside';
}

Upvotes: 1

matiaslauriti
matiaslauriti

Reputation: 8082

You could use get_class that outputs the Class Name and there solve your if with what are you saying

Upvotes: 0

Related Questions