Forums

Sidebar not working (is_page) (9 posts)

  1. benjaminleist
    Member
    Posted 1 week 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. benjaminleist
    Member
    Posted 1 week ago #

    Nothing?

  3. ryanhellyer
    Member
    Posted 1 week 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. benjaminleist
    Member
    Posted 1 week 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".

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

    Thanks a lot!

  5. benjaminleist
    Member
    Posted 1 week ago #

    /push again

  6. benjaminleist
    Member
    Posted 1 week ago #

    Guys, that's really important :/

  7. ryanhellyer
    Member
    Posted 6 days 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. benjaminleist
    Member
    Posted 6 days 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. benjaminleist
    Member
    Posted 6 days 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

Reply

You must log in to post.

About this Topic