0

I have my single-{my custom post type) page. Here the Current post type is showing. Under that I want to show other Custom post type so that I can navigate to other post type. How to do that. Thanks in advance

0

You will need to do a wp_query to get the other post types into your file e.g.

<?php
     $args = array(
      'post_type' => 'posttype_name',
      'posts_per_page' => '-1',
      'order' => 'DESC'
     );
     $query = new WP_Query($args);
     while ( $query->have_posts() ) {
      $query->the_post();
          the_title();
     }
     wp_reset_postdata();
     ?>
|improve this answer|||||
0

I got it ..Here is the Code

<?php
                            $args=array(
    'post_type' => 'my_post_type',
    'post__not_in' => array($post->ID),
    'order'=>'ASC',
    'posts_per_page'=> 3, // Number of related posts that will be shown.
    'caller_get_posts'=>1,
    );

    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post(); 
     the_title();
    the_content();
    endwhile;
    ?>
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.