Forums

[resolved] I need a different sidebar for different pages, was working, not anymore! (7 posts)

  1. pvalure
    Member
    Posted 3 months ago #

    I had multiple sidebars working for another website where I could call in the sidebar in the template as such: <?php get_sidebar('about'); ?>

    I know I updated the functions.php file with the different arrays and names, but I feel like I'm missing something. Something big since it's not working now. Do I need to edit any other files? Did I create another sidebar.php file? I might have had an about-sidebar.php file, but I seriously can't remember and the multiple sidebar tutorials on the web do not seem to work for me.

    When I edit my functions.php file, the sidebars register and I can place widgets in them, but can't get the different one to show on different pages. It seems only my default sidebar shows up.

    I place the dynamic_sidebar code in my footer and call in the footer widgetized sidebar and that is the only one that works fine.

    Any suggestions? I'm going nuts.

  2. blondishnet
    Member
    Posted 3 months ago #

    The include MUST be to the direct file name.

    Example:

    <?php include('sidebar2.php'); ?>

    You cannot put just sidebar2 in its place.

  3. t31os_
    Member
    Posted 3 months ago #

    Actually you can use sidebar-name.php
    <?php get_sidebar('name'); ?>

    For a better example...
    <?php get_sidebar('example') ;?>

    Which would look for and call (if it exists) sidebar-example.php

    Same applies for get_header and get_footer..

    http://codex.wordpress.org/Function_Reference/get_sidebar

  4. pvalure
    Member
    Posted 3 months ago #

    I might have gotten closer to the solution I had before. I edited the dynamic sidebars=1 to desired number of sidebars in the widgets.php file. That seemed to work without having to create another sidebar.php file, but something is still off.

  5. t31os_
    Member
    Posted 3 months ago #

    Why not forget about the old method you used before and just use the built in support for sidebar-NAME.php

    You don't need to do anything other then create the file and the call to the sidebar, eg. get_sidebar('NAME')

  6. pvalure
    Member
    Posted 3 months ago #

    t31os_: I bet that's exactly what I did! Thanks. Maybe I should call it quits after a certain number of hours, my brain might function better. :)

  7. binni_77
    Member
    Posted 3 months ago #

    If u have used the same code in all sidebar(php files) try changing the variable names if there are any.

Reply

You must log in to post.

About this Topic