Support » Fixing WordPress » Use different search results page layout depending on the source page

  • Resolved Miluska


    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. ]

Viewing 1 replies (of 1 total)
  • 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:

    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')

Viewing 1 replies (of 1 total)
  • The topic ‘Use different search results page layout depending on the source page’ is closed to new replies.