WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] My custom widget area does not show in search (10 posts)

  1. christos312
    Member
    Posted 2 years ago #

    Hello to everyone,

    I have created a custom widget area and I have include it to all the template pages and works ok with this code

    <div id="leftsid"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Left_Sidebar") ) : ?><?php endif; ?></div>

    But when I search something on my WordPress site, in the search results page, the sidebar disappears.

    I tried to find in what page I am redirected to include the sidebar but the url look like this

    mysite.com?s=search for search...

    And I really don't know in what page I have to look for and include the coding.

    Anyone have an idea where search form is redirected?

    Regards

  2. saeedqs
    Member
    Posted 2 years ago #

    did you register your sidebar in function.php file?

  3. christos312
    Member
    Posted 2 years ago #

    Yeap, in the function.php in the template folder with the following code

    if ( function_exists('register_sidebar') )
      register_sidebar(array(
        'name' => 'Left_Sidebar',
        'before_widget' => '<div id = "Left_Sidebar">',
        'after_widget' => '</div>',
        'before_title' => '<h3>',
        'after_title' => '</h3>',
      )
    );
  4. saeedqs
    Member
    Posted 2 years ago #

    can u send your template file?
    here is my email add:saeedurrehman15@yahoo.com

  5. christos312
    Member
    Posted 2 years ago #

    Which file? The whole template folder? Or the function.php?

  6. saeedqs
    Member
    Posted 2 years ago #

    template file in which u want to add your custom sidebar . i think u did not add sidebar in your template file

  7. christos312
    Member
    Posted 2 years ago #

    I did add it, in the following pages.

    index.php
    layout1.php
    page.php
    single.php...

    The problem is that when I do a search on my site I am redirected to a different page with the search results.

    On that page the sidebar is disappeared.

    So lets say I am on my home page... I search for "House" when i press search the result page that appears does not have the sidebar, where all the other pages have it...

  8. saeedqs
    Member
    Posted 2 years ago #

    add sidebar in search.php or you can make your own search template

  9. christos312
    Member
    Posted 2 years ago #

    Cool thanks, i didn't notice the search.php in my template folder -.-

    Thanks again!

  10. saeedqs
    Member
    Posted 2 years ago #

    YOU WELCOME :-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.