WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Sidebar not working (is_page) (9 posts)

  1. Ben
    Member
    Posted 6 years ago #

    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

  2. Ben
    Member
    Posted 6 years ago #

    Nothing?

  3. Ryan Hellyer
    Member
    Posted 6 years ago #

    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.

  4. Ben
    Member
    Posted 6 years ago #

    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!

  5. Ben
    Member
    Posted 6 years ago #

    /push again

  6. Ben
    Member
    Posted 6 years ago #

    Guys, that's really important :/

  7. Ryan Hellyer
    Member
    Posted 6 years ago #

    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?

  8. Ben
    Member
    Posted 6 years ago #

    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?

  9. Ben
    Member
    Posted 6 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic