Forums Forums Search & Filter Pro search results and widget logic

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #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
    #12065

    Hey 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
    #12087

    Hello 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 page

    Thank you for replying though, very nice jb with the plugin

    Ross Moderator
    #12408

    Ah so the is_search() allowed it to be shown on the search results page?

    Thanks for the update and the info!

    🙂

Viewing 4 posts - 1 through 4 (of 4 total)