• I can’t find relevant posts that describe this problem, I’ve tried some things on my own but I’m getting nowhere really fast. I’m hoping someone can point out the right way to do this. Thank you in advance.

    I’ll start with the question…

    How should I go about fixing it so the posts page set in the Reading settings accepts my template and actually applies it?

    Here’s my explanation and more information…

    I created a “news” page and filtered its posts with a query_posts call to only get posts with the category of news. — This works great.

    Then on the Reading settings in the Dashboard, I have the main page go to a Static page (Home). And the posts to go to a static page as well and I have this page created and configured as “Blog”.

    I need both “Blog” and “News” page to have a different sidebar than the rest of the site, this custom sidebar makes it more “blog-centric” as opposed to the rest of the page which is more static.

    So I added a sidebar the way I wanted it and I think I got it working fine, it works on the News page (its registered and I see it in the preferences so I can drop widgets etc). I added this to the template I’m using on “News” and so it shows the new sidebar as desired.

    To add the custom sidebar to my “News” page I added this code

    <?php include (TEMPLATEPATH . '/sidebar_blogcentric.php'); ?>

    and removed other calls to the rest of the sidebars.

    However the posts page “Blog” is being driven by “index.php” I know this because if I add a query_posts to the page I can filter what posts end up showing in the Blog page.

    I can’t remove all the sidebars there and add the blog one like I did for “News” because then ALL the other pages also get this sidebar. No problem, I should be able to change the template being used to use the same one as the “News” page does. Or even create a new template and have it use that….

    Therein lies my problem, no matter what template I choose for the static “Blog” page, it gets overridden by the “index.php” settings.

    How should I go about fixing it so the posts page set in the Reading settings accepts my template and actually applies it?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Oscar Gonzalez

    (@rakxzo)

    Was my question too long? TMI? not enough? not clear? Please help me help you help me. ??

    I would appreciate any help on this.

    If I’m understanding you correctly, what you need is

    <?php if (is_page('news')) {
     include (TEMPLATEPATH . '/sidebar_blogcentric.php');
    } ?>
    Thread Starter Oscar Gonzalez

    (@rakxzo)

    Well no, thanks! I think I just figured it out.

    If I did what you suggested it would show both the standard sidebar + the “sidebar_blogcentric.php” which is not what I wanted…

    I was looking to have it show that instead of the standard one.

    I did just figure it out though. I guess in this theme (or maybe this is normal with all themes) the index.php drives the posts view… and so I changed it to not show the standard sidebar and use mine instead. This works…

    Somehow static pages still get the standard sidebar, but my post-from-blog-excluding News-only driven page shows the sidebar I want. I’m not quite sure I know why/how this works but it works.

    thanks for your response stvwlf.

    Well, in that case along with what I said before, also wrap the regular sidebar code in this

    <?php if (!is_page('news')) {
     { sidebar code here }
    } ?>

    Thats a ‘if not page news’.

    Index.php does indeed drive the posts page. You might want to look at this
    https://codex.www.ads-software.com/Template_Hierarchy

    Thread Starter Oscar Gonzalez

    (@rakxzo)

    Doh… that makes sense I should have thought of that before.

    Thanks again stvwlf.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Help with posts page or Blog-view page and its sidebar.’ is closed to new replies.