WordPress.org

Ready to get started?Download WordPress

Forums

Posts related to Custom Post Type (2 posts)

  1. Gianluca Cherubin
    Member
    Posted 2 years ago #

    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

  2. potentweb
    Member
    Posted 2 years ago #

    $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

Topic Closed

This topic has been closed to new replies.

About this Topic