[Resolved] Using GP Premium + WP Show Posts to filter Category & Tags

Home Forums Support Using GP Premium + WP Show Posts to filter Category & Tags

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1233566
    Kir29 LLC

    Hi,

    We’e been using GP Premium + WP Show Posts to filter by Category but due to the increase in content we now must start filtering our posts by Category & Tags using WP Show Posts.

    Is there an easy way to use GP Premium + WP Show Posts adding Category & Tags to meet BOTH criteria (AND) or either criteria (OR)?

    Thanks

    #1234235
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    What do you mean by filtering, exactly? Where can the user choose the category/tag?

    #1234250
    Kir29 LLC

    We have a page using the WP Show Posts and filtering by one category but now we need also to add a tag in the filter (both) so the page only displays posts that meet both the category and the tag.

    Did I explain it a bit better now?

    Thanks

    #1234586
    Tom
    Lead Developer
    Lead Developer

    Ah, got it. WPSP doesn’t have that capability at the moment, unfortunately. We’ve added a filter in the next version which will make altering the query easier when it comes to advanced changes like this.

    If you’d like instructions on how to make the change manually to the plugin, I can try to help.

    #1234751
    Kir29 LLC

    Hi again,

    Yes please, if you could provide instructions to implement the changes that’d be great.

    Could you also let us know when the next version will be available?

    Thanks

    #1235449
    Tom
    Lead Developer
    Lead Developer

    First, you’ll need to make this change to the core code: https://github.com/tomusborne/wp-show-posts/commit/286caf1164db8b6b6f38b85d3a011b519a27f4de

    Then you might be able to do this:

    add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
        if ( 123 === $settings['list_id'] ) {
            $args['tax_query']['relation'] = 'AND';
            $args['tax_query'][] = array(
                'taxonomy' => 'post_tag',
                'field'    => 'slug',
                'terms'    => 'tag-to-search-for',
            );
        }
    
        return $args;
    }, 10, 2 );

    The tax_query parameter is particularly complicated, so I’m not 100% sure this will work.

    No date for the update at the moment.

    #1278896
    Kir29 LLC

    Hi again,

    Looks like we wont be able to change the core code unfortunately so we’ll have to replace using WP Show Posts with another plugging.

    Please let us know once WPSP implements this capability and the next version is released.

    Thanks

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