We're merging with GenerateBlocks! Learn more here.

[Support request] Show Archived posts for one topic

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Show Archived posts for one topic

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35946
    Ema
    Participant

    Hello,

    I’m using WP show posts to display current ‘Projects’.

    I would also like to show an archive of ‘Projects on the same page.

    Is this how?

    <div class="wpsp-project-posts  grid-container">
    	<h2>Project Posts</h2>
    <?php
    if ( is_single() ) {
        $cats =  get_the_category();
        $cat = $cats[0];
    } else {
        $cat = get_category( get_query_var( 'cat' ) );
    }
    
    $cat_slug = $cat->slug;
    $list = get_page_by_title( 'projects', 'OBJECT', 'wp_show_posts' );
    wpsp_display( $list->ID, 'tax_term="' . $cat_slug . '"' );
    ?>
    </div>
    #35966
    elvin
    Moderator

    Hi there,

    That could work but we need to fix it a bit to specify the taxonomy as well.

    Example:

    <div class="wpsp-project-posts  grid-container">
    	<h2>Project Posts</h2>
    <?php
        if ( is_single() ) {
            $cats =  get_the_category();
            $cat = $cats[0];
        } else {
            $cat = get_category( get_query_var( 'cat' ) );
        }
    
        $settings = array(
            'taxonomy' => 'category',
            'tax_term' => $cat->slug,
        );
    
        $list = get_page_by_title( 'projects', 'OBJECT', 'wp_show_posts' );
        wpsp_display( $list->ID, $settings );
    ?>
    </div>
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.