WordPress.org

Forums

sidebar not showing on blog page (9 posts)

  1. bilslandlewis
    Member
    Posted 5 years ago #

    I have created 2 sidebar files which are called from my header.php file and are working as they should using this code:

    <?php
    if (is_page('8')) {
    include(TEMPLATEPATH . '/sidebar-custom.php');
    
    }
    if (is_page('15')) {
    include(TEMPLATEPATH . '/sidebar-discuss.php');
    
    }
    if (is_page('17')) {
    include(TEMPLATEPATH . '/sidebar-custom.php');
    
    }
    if (is_page('19')) {
    include(TEMPLATEPATH . '/sidebar-custom.php');
    
    }
    if (is_page('21')) {
    include(TEMPLATEPATH . '/sidebar-custom.php');
    
    }
    if (is_page('23')) {
    include(TEMPLATEPATH . '/sidebar-custom.php');
    
    }
    if (is_page('25')) {
    include(TEMPLATEPATH . '/sidebar-custom.php');
    
    }
     else {
    include(TEMPLATEPATH . '/sidebar.php');
    }
    ?>

    page 15 is my blog page whoch you can view here:
    http://www.thecreativexchange.co.uk/test/discuss/

    my hope was that another sidebar would display on this page but it won't it just displays the sidebar.php file, i tried to change it to show my other sidebar which is sidebar-custom.php but again it will only show the sidebar.php file.

    Not sure why I can have different sidebars on all the other pages except my blog page, any answers would be a huge help!

  2. Samuel B
    moderator
    Posted 5 years ago #

    you probably need to create your own custom blog page - it's easy
    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

  3. chicamaravilla
    Member
    Posted 5 years ago #

    glad to see this post ... I'm having exactly the same problem.

    In my case, I was also able to get different sidebars working on the pages, but, as bilslandlewis above, I'm also trying to get a different sidebar called up on my "blog" page.

    As suggested above, I created a custom template called "blog.php", but it still pulls the same sidebar as my home page (always the "sidebar.php" file - or maybe I need to add some different code? I included a <?php include ('sidebar_blog.php'); ?> but perhaps it should be something else?).

    Through my research, the issues seems to have something to do with the fact that whatever is set to the "home" page will apply to the "blog" page?

    I'd be okay with a workaround if I would be able to customize either the home or the blog sidebar. I just don't want to have a blogroll, links, categories, etc. showing up on the main page of my site.

    I'm at http://magnoliawebstrategy.com

    Thanks so much!

  4. bilslandlewis
    Member
    Posted 5 years ago #

    Thanks for the tip samboll, I tried it but it will still only load in the sidebar which displays on my home page, not sure how to solve this issue to get a different sidebar in the blog page?

  5. esmi
    Forum Moderator
    Posted 5 years ago #

    Because your blog page isn't a WordPress Page. Therefore the is_page('15') conditional won't work as it applies purely to a WordPress Page with an id of 15.

    Try using is_archive() or is_category('discuss') instead.

  6. chicamaravilla
    Member
    Posted 5 years ago #

    I tried using the is_category('') conditional, in both the blog.php template page and the page.php template page, and that didn't work either. It still pulls the main sidebar.

    I'm really stumped.

  7. bilslandlewis
    Member
    Posted 5 years ago #

    me too, i think esmi you may be on the right track though

  8. bilslandlewis
    Member
    Posted 5 years ago #

    I tried this from the code pages

    Note: If you select a static Page as your frontpage (see below), this tag will be applied to your "posts page".
    The Front Page
    
    is_front_page()

    the code i used in my header file was

    }
    if (is_front_page('discuss')) {
    include(TEMPLATEPATH . '/sidebar-discuss.php');
    
    }

    it did do something but unfortunately placed the sidebar on the front page, i also tried is_single() but that didn't work either??

  9. ToreGu
    Member
    Posted 5 years ago #

    Thanks for this thread! Really helped my with my sidebar problems.

Topic Closed

This topic has been closed to new replies.

About this Topic