Marcio Marcio - 2 months ago 7
PHP Question

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!

Answer

You can use:

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