• Resolved kjagen

    (@kjagen)


    How can I do that. I`ve copied a sidebar and renamed it sidebar2.php

    Butr where is the code to add that sidebar. Not a option in the dashboard? Is it in the code of that specific page?

    I use the standard theme

Viewing 8 replies - 1 through 8 (of 8 total)
  • MichaelH

    (@michaelh)

    With the help of the Template Hierarchy article, determine what Template is displaying your Pages, then use the get_sidebar in that template.

    You will need to rename your sidebar2.php to adhere to the rules detailed in Migrating Plugins and Themes to 2.7:

    * get_header(‘myheader’) will include header-myheader.php
    * get_footer(‘myfooter’) will include footer-myfooter.php
    * get_sidebar(‘mysidebar’) will include sidebar-mysidebar.php

    Thread Starter kjagen

    (@kjagen)

    Hm. I`m new to this so I did not quite get that

    I write
    get_sidebar2

    here
    <?php if (is_page(‘About’)) : ?>
    <?php else : ?>
    <?php get_sidebar2(); ?>
    <?php endif; ?>

    But then the footer disapear, and no other sidebar is there. How can I choose one sidebar for just a couple of pages?

    MichaelH

    (@michaelh)

    If your sidebar script is sidebar-2.php, then use:
    <?php get_sidebar('2'); ?>

    If your sidebar script is sidebar-xyz.php, then use:
    <?php get_sidebar('xyz'); ?>

    Thread Starter kjagen

    (@kjagen)

    Thanks for the answer. I`ll try this later.
    So you will have to go into the code on each page I want to have a different sidebar to.? I can?t get the second sidebar as a option in the dashboard?

    Another questios; I remove the sidebar from a page, to have a big photo across the entire space below the header. That photo at my laptop is still small inside the body, but at work useing a widescreen it works( photo all across)
    Why does it differ like this??

    MichaelH

    (@michaelh)

    I can?t get the second sidebar as a option in the dashboard?

    That’s correct, it’s not something in your dashboard. You will have to code the template you started with the copy to sidebar2 and refer to it in your other templates as suggested.

    I’ll direct you to CSS on your 2nd question.

    Thread Starter kjagen

    (@kjagen)

    have tried this for a diffent sidebar ( 2) some some pages

    <?php if (is_page(‘Iron Maiden’,’Concerts’)) : ?>
    <?php get_sidebar(2); ?>
    <?php endif; ?>

    Here it is just the first page ( Iron Maiden) it works for, Not Concerts? Is it not correct written?

    MichaelH

    (@michaelh)

    <?php if (is_page('Iron Maiden') || is_page('Concerts') ) : ?>

    https://www.w3schools.com/PHP/php_operators.asp

    FendyBt2

    (@fendybt2)

    There’s an easy way to do that… You can try this cool Widget Logic plugins I’ve found and currently used… ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to add a different sidebar to a page’ is closed to new replies.