Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Setting class of results page?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Steven
    #19354

    Hi there.

    On my form I now have a submit and reset button, but I don’t want reset visible if the form is being viewed on the homepage. I thought a simple body.home a.search-filter-reset { display: none; } would do the trick, which to an extent it does. However, if I use the form on the home page the results page still has the body set to class="home ...".

    Conversely, if I use the form while on the archive page for my custom post type, the results page inherits the archive page’s body classes.

    So it appears that the results page for this form inherits the body class of wherever the user was directed from. Is there a way around this, or is this currently in the works for 2.0? 🙂

    Thanks!

    — Update —

    That information is wrong… after looking a second time the results page’s <body> tag is set to home regardless if the form was used on the home page or the results page. Is there any way to “inject” a results-page class, or something similar?

    Trisha Miller
    #19376

    SO if I understand correctly, you DO want the “reset” button to show on the results page?

    Probably the best solution is to copy the default “results.php” to a new template. Name the template with the ID of your form (eg. if your form has the ID of 215, your new template would be named 215.php)

    Put this file in a sub-folder of your Theme, named search-filter. This is where the plugin will look for custom search results template files.

    Then in your new template, surround the results with a DIV that has a class that you can style however you want, and you can target that button in that style.

    Lastly, use the Shortcode method, and insert the shortcode into the Page Template where you want results to show….enter that Page into the box shown when you select “shortcode” in the plugin settings under Display Results.

    In my case, I have the form and results on a custom page template I created, and I have a Page that uses that Template.

    In that custom page template, I put the shortcode where I want it (there is other content above and below my search results and form)….e.g. echo do_shortcode(‘[searchandfilter id=”102″ show=”results”]’); (surrounded by the PHP open/close tags, which I don’t think will show here).

    In the settings for my form, I select “use shortcode” and enter my Page (URL) in the box (e.g. “http://www.mysite.com/myPage/&#8221;).

    I hope this helps – by customizing the page on which your form and results display, you have more opportunity to declare your own style selectors, and then style things however you like.

    Ross Moderator
    #19418

    Hi Steven

    Trisha is correct.

    The the thing is, if you were not using Ajax – the page would refresh, and the classes on the body tag would update accordingly.

    But when using ajax the results will inherit the classes of the page.

    So, you can either wrap a div around your results and assign a class/id, or manually assign a class to those pages you know where searches will be initiated – please see this post on instructions on how to add classes to S&F pages:

    https://support.searchandfilter.com/forums/topic/wp-4-2-1-update-affecting-plugin/page/2/#post-17059

    Thanks

    Steven
    #19436

    Excellent,

    Thanks guys.

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

The forum ‘Search & Filter Pro’ is closed to new topics and replies.