• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Replace Site Logo Conditionally

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Replace Site Logo Conditionally

This topic is: resolved

Tagged: Logo

  • This topic has 8 replies, 2 voices, and was last updated 10 years ago by carasmo.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • November 10, 2015 at 9:55 am #170671
    bisonbrah
    Participant

    I need some assistance with changing the site logo from black to white on specific portfolio pages. I have tried via CSS, PHP and JS; but nothing has worked thus far. The logo is wrapped in a <div class="site-logo"> within <div class="title-area"> .

    Any assistance would be phenomenal for I've exhausted all other options.

    Thanks in advance!

    http://ssstudios.wpengine.com/portfolio/balpark-media/
    November 10, 2015 at 10:24 am #170682
    carasmo
    Participant

    I see you already have a class .label-white-header on your body. Good.

    Change the absolute paths. Put in your JQuery file after your document ready function in main.js

    
          // full urls in between the ticks
          var 
          logodefault = 'http://christinacreativedesign.com/assets/images/main-logo.png',
          logowhite = 'http://christinacreativedesign.com/assets/images/white-logo.png';
    
          if ($('body').hasClass('label-white-header')) {
             $('img[src="' + logodefault + '"]').attr('src', logowhite);
          }
          else {
             //default logo
             $('img[src="' + logowhite + '"]').attr('src', logodefault);
          }
           //end if label white header

    Genesis Theme Customization and Help

    November 10, 2015 at 10:40 am #170687
    bisonbrah
    Participant

    Thanks for that advise; however, I've done what you recommended and still isn't working :/

    //replace black logo with white logo
    	  // full urls in between the ticks
          var 
          logodefault = '/wp-content/uploads/genesis-extender/plugin/images/logo.png',
          logowhite = '/wp-content/uploads/genesis-extender/plugin/images/logo-white.png';
    
          if ($('body').hasClass('label-white-header')) {
             $('img[src="' + logodefault + '"]').attr('src', logowhite);
          }
          else {
             //default logo
             $('img[src="' + logowhite + '"]').attr('src', logodefault);
          }
           //end if label white header
    November 10, 2015 at 11:06 am #170691
    carasmo
    Participant

    Absolute path, that's how WordPress rolls.

    http://yourdomain.com/....

    http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/


    Genesis Theme Customization and Help

    November 10, 2015 at 11:11 am #170692
    bisonbrah
    Participant

    Tried with absolute paths as well - no change :/

    November 10, 2015 at 11:16 am #170695
    carasmo
    Participant

    I looked in your main.js file, the code is not there. Where are you putting it?

    When you do get it to work, the absolute paths have to be there and your full url to your logo is:

    http://ssstudios.wpengine.com/wp-content/uploads/2015/11/logo.png

    Not:

    http://ssstudios.wpengine.com/wp-content/uploads/genesis-extender/plugin/images/logo.png

    The jQuery looks for an exact path to an existing file then it swaps, if that plus the hasClass condition is met.


    Genesis Theme Customization and Help

    November 10, 2015 at 11:32 am #170698
    bisonbrah
    Participant

    Woot I got it working - I was trying to load it via Genesis Extender's js module. Once I moved theme to uploads and saved in main.js it worked perfectly! Thanks again so very, very much!

    November 10, 2015 at 11:42 am #170699
    carasmo
    Participant

    Cool. Please mark this resolved in the toggle.


    Genesis Theme Customization and Help

    November 10, 2015 at 12:19 pm #170702
    carasmo
    Participant

    Also, in your case, you won't need the else.

    else {
             //default logo
             $('img[src="' + logowhite + '"]').attr('src', logodefault);
          }

    Not required. Don't remove other stuff.


    Genesis Theme Customization and Help

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble