WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Different Logos On Different Pages (5 posts)

  1. davidrosen
    Member
    Posted 1 year ago #

    hi,

    was just told to try posting here. i'm trying to make this wordpress theme do an if/then/else type thing for the logo. i'm not a coder or anything but i can follow instructions. so far not getting it though. the original code looks like this:

    <div id="logo">
    <a href="<?php bloginfo('url'); ?>"><img src="<?php echo of_get_option('logo') ?>" alt="" /></a>
    </div>

    i'd like to make it so that if the page being displayed is the blog (page name is 'lifestyle-blog') it will display a different logo (lets say logo2.png) and if its any other page it will just do as the code there says to do (taking the logo from the wordpress logo option and just using that.

    can anyone help me out?

    thanks

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    try:

    <div id="logo">
    <a href="<?php bloginfo('url'); ?>"><img src="<?php if( is_home() ) { echo get_stylesheet_directory_uri() . '/images/logo2.png'; } else { echo of_get_option('logo'); } ?>" alt="" /></a>
    </div>

    the above code assumes that the 'blog' page is the page which is set as posts page (checked with the is_home() conditional tag) and that the logo2.png image is saved in the /images folder of the theme.

  3. davidrosen
    Member
    Posted 1 year ago #

    WOW... we are SO close... haha. thanks so much for your response! it definitely works but there's still a problem...

    the theme i'm using is called Village, and part of the village theme's documentation specifically states that the "Posts Page" need to just be left blank and not assigned to my blog page. Then my blog page ('Lifestyle Blog') just uses a blog theme and it works as a blog...

    So is there any way to edit what you did, becuase it definitely worked to make the logo change on the blog page if i set the "posts page" to my 'Lifestyle Blog' page, but then my blog is just a blank page (again because of the theme setup).

    I'm going to also contact the theme creator to see if they have any thoughts on this. I really appreciate your help on this.

  4. davidrosen
    Member
    Posted 1 year ago #

    *Blog page uses a Blog "template" i meant to say, not blog theme...

  5. davidrosen
    Member
    Posted 1 year ago #

    I GOT IT!!! Haha, sorry I'm so excited cause this is the first complete wordpress site I've ever put together and these 2 issues have just been killing me.

    I changed if (is_home() to if (is_page('lifestyle blog') and it works!

    Thanks SO much for your help

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.