[resolved] Use different search results page layout depending on the source page (2 posts)

  1. Miluska
    Posted 3 years ago #

    Hello everybody, I'm new and I searched similars topic but I did'nt find anything so...Can you help me please? =)

    Italian site with some pages in english (english area of the site)

    When user searchs from these english pages, results page shows the default template, it's in italian and it has a different sidebar.
    How can I keep the english template when i get results page?

    english area uses two template i create:
    "english_home.php" and "english_interno.php".

    This is the search results layout for the italian part:
    This is the internal layout for the English part, I would to keep this layout for search results page:


    [ Please don't bump, that's not permitted here. ]

  2. Miluska
    Posted 3 years ago #

    Ok, I solved this little problem, also thank to a kind guy on Google+.
    I post it, if anyone (newbies like me) need something like this.

    Basically, I follow suggestion of this site: http://www.rob-barrett.com/2009/05/multiple-search-results-pages-within-one-wordpress-site/

    I added a new line into search form, see the example (from the linked site): <input name="site_section" type="hidden" value="blog" />

    <form id="searchform" action="<?php bloginfo('home'); ?>/" method="get">
    <input id="s" maxlength="96" name="s" size="18" type="text" value="Search" />
    <input name="site_section" type="hidden" value="blog" />
    <input id="searchsubmit" class="hidden" type="submit" value="Search" />

    Then I put an IF to take only english template parts, so i modify header.php, sidebar.php, footer.php and also search.php.
    I use this code to call the value in the top of these files:
    $search_refer = $_GET["site_section"];
    Then i add some If just when it needed.
    if ($search_refer == 'blog')

Topic Closed

This topic has been closed to new replies.

About this Topic