Forums › Forums › Search & Filter Pro › search results and widget logic
Tagged: search widget on specific pages
- This topic has 3 replies, 2 voices, and was last updated 10 years, 2 months ago by
Ross.
-
Anonymous(Private) February 16, 2015 at 8:38 pm #12013
i am trying to setup
http://www.vasslaw4.radevic.com/publications-search-results-page/?s=
to have a widget at the top … for now i managed to get the widget going using widget logic for all categories and the single post pages…
i cannot get the widget to work on the search result page
here widget search and filter works on top
http://www.vasslaw4.radevic.com/category/publications-en/
http://www.vasslaw4.radevic.com/acquisition-of-immovable-property-by-aliens-2013/i want that widget to work on this page as well where the search results are
http://www.vasslaw4.radevic.com/publications-search-results-page/?s=widget logic code
is_category(array(57,76,77,78)) || (is_single() && in_category(76)) || (is_single() && in_category(77)) || (is_single() && in_category(78)) || (is_single() && in_category(57)) || is_page(1601)Ross Moderator(Private) February 17, 2015 at 11:43 pm #12065Hey Nemanja
I think you can configure widget logic to use the URL? I don’t use it personally so can’t advise but I had a user mention this to me.
Also, the “widget logic code” you posted is perfectly normal template code, so in the scenario of a template, to identify a search form I would use:
global $sf_form_data; if ( $sf_form_data->is_valid_form() ) { //do stuff }
Not sure how you can change your code but I would try to do something like:
“is_category(array(57,76,77,78)) || (is_single() && in_category(76)) || (is_single() && in_category(77)) || (is_single() && in_category(78)) || (is_single() && in_category(57)) || is_page(1601)||$sf_form_data->is_valid_form()”
However somewhere you must initialise the global in the first example.
Thanks
Anonymous(Private) February 18, 2015 at 8:37 am #12087Hello well it would be nice for people to have this option since it s a search widget people need to show the widget on search results page rather than going back
Anyways i fixed the error with the normal widgetlogic plugin
is_category(array(57,76,77,78)) || (is_single() && in_category(76)) || (is_single() && in_category(77)) || (is_single() && in_category(78)) || (is_single() && in_category(57)) || is_search()
So you can put this in your documentation if someone needs
The above code means that the widget will show on category pages with ID 57,76,77,78
It will also show up on single posts that are in categories 57,76,77,78
and it will also show on the search result pageThank you for replying though, very nice jb with the plugin
Ross Moderator(Private) February 25, 2015 at 11:16 pm #12408Ah so the
is_search()
allowed it to be shown on the search results page?Thanks for the update and the info!
🙂
-
AuthorPosts