[Resolved] Including more than one post type

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Including more than one post type

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  Tom 2 weeks ago.

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

    Michael
    Participant

    Hi Tom and team

    Is there a way to create one ‘show posts’ to include multiple post types – for example, ‘posts’ and a few cpts?

    Was thinking of using the Flint Skin Dispatch front page as a bit of a template/inspiration (on the Generate Press site library), but wanted to know if there was a way to mix in some cpts to the display.

    Many thanks for any help and ideas. Just renewed GP and an amazed at the value.

    Cheers

    Mike

    Ps apologies if I’ve missed anything obvious.

    #13241

    Tom
    Keymaster

    Hi Mike,

    It’s possible, but it’ll take some tweaking.

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

    Then you can do this:

    add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
        if ( 123 === $settings['list_id'] ) {
            $args['post_type'] = array( 'post', 'another-type', 'one-more' );
        }
    
        return $args;
    } );

    You just need to update 123 with the ID of the list.

    #13336

    Michael
    Participant

    Many thanks Tom!

    #13350

    Tom
    Keymaster

    No problem! 🙂

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

You must be logged in to reply to this topic.