WordPress.org

Support

Support » How-To and Troubleshooting » Posts related to Custom Post Type

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.
    Thanx

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();
    the_title();
    echo ‘<div class=”entry-content”>’;
    the_content();
    echo ‘</div>’;
    endwhile;

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

    http://codex.wordpress.org/Post_Types

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