Support » Fixing WordPress » Posts related to Custom Post Type

  • Hello all!
    Is there a way to show a loop of related default posts inside a CPT? I can’t understand if the connection between them has to be done by taxonomy.

Viewing 1 replies (of 1 total)
  • $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 10 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    echo ‘<div class=”entry-content”>’;
    echo ‘</div>’;

    You change ‘post_type’ => ‘product’ to whatever your custom post type is called.

Viewing 1 replies (of 1 total)
  • The topic ‘Posts related to Custom Post Type’ is closed to new replies.