We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 990 total)
  • Author
    Posts
  • in reply to: Showing only forthcoming event in post #36679
    elvin
    Moderator

    Hi Ema,

    All my CPT event posts have the ACF field of ‘start_date’ – how does this only show the current events.

    It should be possible but we’ll have to resort to a bit of modification to the plugin’s file.

    Make this change in your wp-show-posts.php file: https://github.com/tomusborne/wp-show-posts/commit/286caf1164db8b6b6f38b85d3a011b519a27f4de

    We then need to do some filtering. The PHP will be something like this:

    add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
        if ( 4943 === $settings['list_id'] ) {
            $args['meta_query'] = array(
                array(
                'key' => 'start_date',
                'orderby' => 'meta_value_num',
                'order' => 'DESC',
                )
            );
        }
        
        return $args;
    });

    The key params’ value is your ACF slug. The order param value is there sorting order depending on what you’ve set on orderby param. These order params can be omitted.

    in reply to: Showing posts from a tag? #36647
    elvin
    Moderator

    Hi Ema,

    Hello! is there a way that I can show posts from a Category that spans all 4 of my CPTs?

    It should be possible but we’ll have to resort to a bit of modification to the plugin’s file and a bit more custom PHP for filtering the query.

    Make this change in your wp-show-posts.php file: https://github.com/tomusborne/wp-show-posts/commit/286caf1164db8b6b6f38b85d3a011b519a27f4de

    The PHP will be something like this:

    add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
        if ( 123 === $settings['list_id'] ) {
            $args['post_type'] = array('post','custom_post_type_slug_1','custom_post_type_slug_2','custom_post_type_slug_3');
            $args['tax_query'] = array(
    			'relation' => 'OR',
    			array(
    				'taxonomy' => 'topics',
    				'field'    => 'slug',
    				'terms'    => array( 'featured','another-topic-term' ),
    			)
        	);
        }
    
        return $args;
    } );

    Change 123 to the WPSP list ID you’re displaying this on and change $args['post_type'] = array('post','custom_post_type_slug_1','custom_post_type_slug_2','custom_post_type_slug_3'); to add the post type slugs.

    You’ll also have to change 'terms' => array( 'featured','another-topic-term' ), array slugs to featured + other “Topics” term slugs you want to include. 😀

    in reply to: My account has yet to be migrated to GenerateBlocks. #36564
    elvin
    Moderator

    Hi there,

    The team is still processing through the list of users who filled the form. There’s a bit of a slowdown as this move coincided w/ WordPress 5.9’s release but it’s still being checked. 😀

    As WPSP’s license expiring:

    If the worry is WPSP not working after it’s license expiry, you can rest assured that it’ll continue to work.

    The license is mainly to have the privilege to update the plugin and receive support. Since there’ll be no further updates until the merge w/ GB, the installed plugin can stay as it is. 🙂

    Support will still be provided. I’ll make sure to go back to this and let everyone know about any updates. 😀

    in reply to: exclude a tag from a list #36541
    elvin
    Moderator

    No problem. Let us know if you need further help. 😀

    in reply to: My account has yet to be migrated to GenerateBlocks. #36469
    elvin
    Moderator

    Hi there,

    The request from the form you’ve filled in requires a bit of processing.

    You should receive an email through the email address you’ve provided, specifying the steps to claim your GenerateBlocks Pro license once Tom has processed the request.

    Let us know if you have further questions. 🙂

    in reply to: Title link to new window #36464
    elvin
    Moderator

    No problem. 😀

    in reply to: Show Posts From a Category #36462
    elvin
    Moderator

    Hi Ben,

    There are 2 ways to do this.

    You can either do this using shortcode.

    Example: [wp_show_posts id="761" settings="taxonomy=category&tax_term=post-cat-1, post-cat-2"]

    or through the WPSP edit list’s Meta tab as shown here
    -https://share.getcloudapp.com/7KuqAeld

    in reply to: Title link to new window #36446
    elvin
    Moderator

    Hi Hans,

    The link is hard-coded, unfortunately.
    https://github.com/tomusborne/wp-show-posts/blob/35e410d7800273fc66f211c0f80d553e95d17f83/wp-show-posts.php#L439

    Consider adding it using a javascript.

    Something like:

    var title_link = document.querySelectorAll('.wp-show-posts-entry-title > a');
      for (var i=0; i<title_link.length; i++){
            title_link[i].setAttribute('target', '_blank');
      }

    Hook this on your site’s wp_footer.

    in reply to: exclude a tag from a list #36444
    elvin
    Moderator

    There’s no complete documentation for this, unfortunately.

    There will likely be one when GenerateBlocks gets merged with WP Show Posts and it’ll likely be posted as part of GB’s documentation.

    For now, you can ask us here for any specific parameters or you can search around the forums for shortcode usages. 🙂

    in reply to: exclude a tag from a list #36427
    elvin
    Moderator

    Hi there,

    You can do it like this:

    [wp_show_posts id="18" settings="taxonomy=post_tag&tax_term=test-tag-1&tax_operator=NOT IN"]

    Use tag slug on tax_term=

    in reply to: How to sort posts by Views Count Descending Order #36426
    elvin
    Moderator

    Thanks for letting us know. Glad you got it sorted. 😀

    in reply to: How to sort posts by Views Count Descending Order #36412
    elvin
    Moderator

    Would be awesome if some day Tom decides to add this simple option( in More settings -> Order by) to the WP Show Post Block when ported to GenerateBlocks. This will make your plugin more polyvalent and useful.

    Now may be a good time to suggest a feature since Tom’s in the process of merging WPSP and GB. Perhaps he can add things in while he’s at it.

    You can raise a feature request here –
    https://community.generateblocks.com/c/feature-requests/6

    And/or here-
    https://github.com/tomusborne/generateblocks

    although I suggest going through the community first so it gets more votes, so Tom finds it something to prioritize. 🙂

    in reply to: How to sort posts by Views Count Descending Order #36409
    elvin
    Moderator

    Ah I see why the code wasn’t working.

    This code assumes your posts already have a post_views_count meta on them. I’ve checked the site and the posts doesn’t have this meta.

    The post counting meta is something you’ll have to apply to the posts. It’s not something WP Show Posts automatically adds.

    You’ll either need a plugin for that or create the custom functionality for it.

    in reply to: How to sort posts by Views Count Descending Order #36405
    elvin
    Moderator

    Is it solely for sorting the posts?

    If it’s solely for sorting the posts then I think what you need is $args[‘orderby’] and $args[‘order’].

    add_filter( ‘wp_show_posts_shortcode_args’, function( $args, $settings ) {
    if ( 9463 === $settings[‘list_id’] ) {
    $args[‘orderby’] = 'meta_value_num';
    $args['meta_key'] = 'post_views_count';
    $args['order'] = 'DESC';
    
    return $args;
    },10,2);

    Use this parameter as reference – https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters

    in reply to: How to sort posts by Views Count Descending Order #36400
    elvin
    Moderator

    Ah I see,

    I assumed you did the necessary changes to the plugin’s code for this filter to work.

    The Uncaught ArgumentCountError: Too few arguments to function error is because the current official release takes only 1 arg for thewp_show_posts_shortcode_args filter.

    For it to take 2 arguments, you’ll have to do Tom’s instructions here – https://wpshowposts.com/support/topic/can-i-exclude-with-a-custom-meta-field-from-a-list/#post-13344

Viewing 15 posts - 1 through 15 (of 990 total)