Forums

[resolved] custom sidebar depending on page (5 posts)

  1. grishart
    Member
    Posted 1 year ago #

    Hi all
    How do I set up a custom sidebar that gets called upon depending on the page the viewer is on?

    I want a custom sidebar for about us and another custom one for what we do?
    Is this possible?

    Thanks for your time.

  2. t-p
    Member
    Posted 1 year ago #

  3. MichaelH
    Volunteer
    Posted 1 year ago #

    Something like this in your Page Template

    if ( is_page('12') ) {
      get_sidebar('example12');
    } else {
      get_sidebar('example22');
    }

    Get either sidebar-example12.php or sidebar-example22.php

    See:
    Function_Reference/get_sidebar
    Conditional Tags
    Page Template

  4. marquex
    Member
    Posted 1 year ago #

    Try to use the custom sidebars plugin, you will be able to get what you want without coding.

    Cheers

  5. grishart
    Member
    Posted 1 year ago #

    thanks everyone I now have it working

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.