Forums › Forums › Search & Filter Pro › URL Parameters Not Working On Home Page (Redirecting To Index.php)
Tagged: front page, Home page, pagination, parameters
- This topic has 22 replies, 3 voices, and was last updated 8 years, 1 month ago by Ross.
-
Anonymous(Private) August 12, 2016 at 8:06 pm #54462
Hi,
I’m implementing an AJAX search via shortcode that works perfectly when tried on every page except the home page.
The search works on initial queries when landing on the home page. The problem occurs when passing any parameter except “sf_paged”.
Example
– http://example.com/sfpaged=2 (this works fine)However, any other parameter used (like below) redirects me to index.php (which shows nothing).
– http://example.com/?_sft_type=nameBtw, I’m using front-page.php for the home page template.
Because parameter-based links are not working properly, pagination does not work on search queries so the search is ineffective.
Hoping you can help! Thanks 🙂
Trevor(Private) August 13, 2016 at 9:29 am #54481In the WordPress settings, does your home page contain the blog, or is it a specific page?
In general, the shortcode results method needs to use our results.php template (see our documentation on this), which is often a problem for some themes, especially if the main blog is on the home page. Some users edit the theme template file for their home page and add the shortcode id to the arguments being passed to the wp query, but this has the drawback that a theme update will overwrite this.
The most common rsults method used for home pages in the display as an archive method, where you can then specify the same template as is already used by the theme for the home page.
Anonymous(Private) August 13, 2016 at 6:46 pm #54507Thanks for the response. In settings I have the front page as static & the chosen template doesn’t use any custom queries. It’s wrapped in “if ( have_posts() ) while ( have_posts() ) : the_post();” & that’s it. What’s in between is the search form shortcode & the results shortcode wrapped in the results div.
When I use the template on inner pages, everything works fine and I’m currently using results.php (with the default structure).
I created front-page.php as a replica of the chosen front-page template because I saw someone mention that as a potential solution, but had no luck.
I’ve tried using an archive, but I’m a bit confused tbh & can’t get it to work. I feel like the shortcode method should be doable. I’m very close – it’s just those pesky parameters. Thanks again!
Trevor(Private) August 14, 2016 at 8:24 am #54525I am a bit puzzled about the urls I am seeing on the show more, and about what the show more actually does.
Home page example:
http://swiped.staging.wpengine.com/?sf_action=get_results&_sft_swipetype=advertorial&sf_paged=2
Classic Page example:
http://swiped.staging.wpengine.com/classics?sf_action=get_results&_sft_persons=david-ogilvy&sf_paged=2
I don’t recall seeing the
sf_action=get_results
before in a url? Maybe I have always missed it. I can’t see it on our demo pages either. What version of the plugin is this? Also note in the second example url that there is no/
before the query string. That too is odd.The results are not being loaded in different pages, but instead load to the bottom. This is not normal WP behavior, so are you using a plugin or script to do this?
-
AuthorPosts