WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Sidebar not working (is_page)

[Resolved] Sidebar not working (is_page)

  • Ben

    @benjaminleist

    Hey folks,
    I got the following code in my sidebar.php:

    if (is_page('home')) (!function_exists('dynamic_sidebar') || !dynamic_sidebar(2));
    elseif (is_page('news')) (!function_exists('dynamic_sidebar') || !dynamic_sidebar(3));
    else (!function_exists('dynamic_sidebar') || !dynamic_sidebar(1));

    Sidebar 2 is displayed on the index page, sidebar 1 is displayed on all pages.

    But on the news page the default sidebar (1) is displayed instead of sidebar 2. Why?

    My index page shows a “page” (home) and my articles (the blog) is displayed on the page “news”.

    Sincerely,
    Ben

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

    @benjaminleist

    Nothing?

    Sidebar 2 is displayed on the index page

    By “index page” do you mean the WP Page labelled “Home”?

    But on the news page the default sidebar (1) is displayed instead of sidebar 2. Why?

    No idea, because (unless I’ve misread) according to your script it should be displaying sidebar 3.

    Ben

    @benjaminleist

    My index/home page is a page created by me, labeled “home”.
    The blog/news is displayed on a page created by me, labeled “news”.

    http://www.belite.de/index.php (in german)

    Thanks a lot!

    Ben

    @benjaminleist

    /push again

    Ben

    @benjaminleist

    Guys, that’s really important :/

    I still don’t get it. Like I said before, isn’t your news page supposed to be rendering sidebar 3 anyway? Or did I completely misread the code?

    Ben

    @benjaminleist

    Ryan, could there be a function like is_article_page or something like that? I’m using 2.5.1 like I said before, and changed the settings to:

    home site (www.belite.de) displaying a page, not the articles
    news site (www.belite.de/news) displaying the articles

    Maybe that’s the reason?

    Ben

    @benjaminleist

    if (is_page('home')) (!function_exists('dynamic_sidebar') || !dynamic_sidebar(2));
    elseif (is_page('aktuelles')) (!function_exists('dynamic_sidebar') || !dynamic_sidebar(3));
    else (!function_exists('dynamic_sidebar') || !dynamic_sidebar(1));

    aktuelles = news

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Sidebar not working (is_page)’ is closed to new replies.
Skip to toolbar