• If someone could point me in the right direction… it would greatly be appreciated.

    I understand how to add custom content types but how do I get them to show up in the loop? I’d almost like a Tumblr like look… if it’s just a link then when you click on the title… it’s just the link. Is there a way to modify the loop for content types?

Viewing 1 replies (of 1 total)
  • You have to construct your own WP_Query() object, assign it to the global $wp_query variable and then do the loop.

    global $post, $paged, $wp_query;
    
    $args = array(
       'post_type' => $post_type,
       'post_status' => 'publish',
       'paged' => $paged,
       'posts_per_page' => 5, //TODO: options
       'caller_get_posts' => 1
    );
    
    $temp_post = $post; // assign original post to temp variable
    $temp_query = $wp_query;  // assign orginal query to temp variable
    $wp_query = new WP_Query($args);
    
    while ( have_posts() ) {
       the_post();
    
       // Here you can echo any post attributes, for example:
       the_title();
    }
    
    // And don't forget to restore everything to its original values
    $wp_query = $temp_query;
    $post = $temp_post;
    
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Types / The Loop’ is closed to new replies.