Site logo

[Resolved] Search & Filter Pro plugin

Home Forums Support [Resolved] Search & Filter Pro plugin

Home Forums Support Search & Filter Pro plugin

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2474096
    Sigfus

    Hi there

    I´m building my first WP webste with the GeneratePress theme and GenerateBlocks. The best WP theme/blocks I have used so far!

    I have been trying to get the Search & Filter Pro plugin to work on this website to filter custom post type archives but so far without success. I then came across the following post from April this year in this forum:

    https://generatepress.com/forums/topic/search-and-filter-plugin/

    If I understand this correctly Search&Filter does not work with the GeneratePress theme but you are working on it. What is the status of that update now?

    Best regards
    Sigfús

    #2474266
    Fernando
    Customer Support

    Hi Sigfus,

    We recommend now using GenerateBlocks’ Query Loop Block for queries.

    With this, you can filter in the Search & Filter ID for it to work.

    Specifically, you could try adding this snippet:

    add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
    		if ( ! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'cu-query' ) !== false ) {
    			$query_args['search_filter_id'] = 123;
    		}
     
    		return $query_args;
    	}, 10, 2 );

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    Then, give the Grid Block of the Query Loop a class of cu-query.

    Adding Custom Classes: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/

    This code adds the Search & Filter ID as an argument to the Query.

    #2474556
    Sigfus

    Dear Fernando
    I got it to work! Thanks a millon!
    Sigfús

    #2475179
    Fernando
    Customer Support

    You’re welcome, Sigfus!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.