[How to] Search results landing page with custom header for each language
-
Hello!
I tried finding something similar in the support pages, but I couldn’t. I couldn’t find something useful and I couldn’t go through all 115 pages of them. Neither did I find on google.
I’m using the latest version of both WordPress and Polylang, and my homepages links to static pages on all 5 languages of my installation.
I’m running a theme I built myself, for a customer who wants menus that are counter-intuitive, so they don’t match the structure of the pages, therefore there is no menu function installed in the theme, it’s all made manually.
The (hopefully) last issue I’m having is finding a way to direct search results to language specific pages. So if I’m searching in English, I want the results to be shown in category-en.php not the default category.php or index.php which use the default Romanian language for Header / Sidebar / Footer.
This is what I used to make the search form in the php files:
<form action="" method="get"> <input type="text" value="<?php the_search_query(); ?>" name="s" placeholder="Caută" class="footer-search-input"/> <input type="button" value="" class="footer-search-submit"/> </form>
The search is working fine, I’m only receiveing language specific results. The only issue is the fact that it’s using a template for the default language.
For category uses I used functions.php, with something I did find in the support forums, that looks something like this:
add_filter( 'category_template', 'my_category_template' ); function my_category_template($template) { if(is_category(array(26,36,50,56,474,86,96,106,116))){ $template = locate_template(array('category-en.php')); return $template; }
Here’s a link to the project.
Your help will be much appreciated!
~ uskro
- The topic ‘[How to] Search results landing page with custom header for each language’ is closed to new replies.