Avada Forums Community Forum multiple logos for different pages Reply To: multiple logos for different pages

Post count: 3

After several hours of searching for a solution, I came up with something relatively simple… and it works beautifully! It’ only requires a small line of code in your php file and some css. Ok let’s get to it!

1. Add a call to the logo in your “logo.php” file. If you’re running the most up-to-date version of Avada, the header.php references logo.php to insert site logo in to header. You’re also going to add a class to the site logo. Your code block in the php file may look something like below. Note that I only included the avada logo php call as a reference of the code block you’re looking for. I suggest putting your custom logo path below it. Don’t forget to add a class on that avada logo though.

<!– standard logo –>
< img class=”some-class” src=”<?php echo esc_url_raw( $standard_logo[‘url’] ); ?>” srcset=”<?php echo esc_attr( $standard_logo[‘srcset’] ); ?>” width=”<?php echo esc_attr( $standard_logo[‘width’] ); ?>” height=”<?php echo esc_attr( $standard_logo[‘height’] ); ?>”<?php echo $standard_logo[‘style’]; // phpcs:ignore WordPress.Security.EscapeOutput ?> alt=”<?php echo esc_attr( $logo_alt_attribute ); ?>” data-retina_logo_url=”<?php echo esc_url_raw( $standard_logo[‘is_retina’] ); ?>” class=”fusion-standard-logo” />

<!– conditional logo based on page ID –>
< img class=”some-other-class” src=”/wp-content/uploads/2023/01/custom-logo.png” >

So what you’ve done is basically add a second logo to the header. Now we’ll use some simple css and page IDs to reference this conditional logo as needed 🙂

2. Here’s the css:

/*** Conditional logos ***/

.some-other-class {display:none;}
.page-id-4201 .some-other-class {display:block;}
.page-id-4201 .some-class {display:none;}

So you’re using the page ID sort of like a media query. Badda bing badda boom!

  • This reply was modified 2 weeks, 6 days ago by jrockey.
  • This reply was modified 2 weeks, 6 days ago by jrockey.
  • This reply was modified 2 weeks, 6 days ago by jrockey.