WordPress.org

Ready to get started?Download WordPress

Forums

Show postd from multable post types (1 post)

  1. sdesigns
    Member
    Posted 11 months ago #

    I am trying to have a page with multable custom post types showing on it I have gotten the below code to work after tying many options but I need it to show just one catigory within each of the post types outdoor-recreation.

    <?php
    // set the $paged variable
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    // query the posts of your custom post types
    query_posts( array(
    		'post_type' => array(
    					'post',
    					'outtakes',
    					'stories'
    				),
    				'paged' => $paged ) // for paging links to work
    			);
    ?>
    
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
            							<div class="metadate"><?php the_time('l, F j, Y') ?></div>
    
    <h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    
    <div id="featuredimage">
    
    <?php
    if ( has_post_thumbnail()) {
      echo '<a href="' . get_permalink($post->ID) . '" >';
      the_post_thumbnail();
      echo '</a>';
    }
    ?><!-- end featured image --></div>
    					<div class="entry">
                        <?php the_excerpt(); ?>
    
    					</div>
                                     <br class="clearfloat" />
    
    				</div>
    
    	<?php endwhile; ?>
    
    <?php wp_pagenavi(); ?>
    
    	<?php else : ?>
    
    		<h2>Not Found</h2>
    
    	<?php endif; ?>

    I have tried to change out the array to

    'post_type' => array(
    					'post&category=outdoor-recreation',
    					'outtakes&outtake_category=outdoor-recreation',
    					'stories&story_category=outdoor-recreation'
    				),
    				'paged' => $paged ) // for paging links to work
    			);
    ?>

    But that gives me a not found.

    Any help with this would be appreseated as I am stumped on this one

Reply

You must log in to post.

About this Topic

Tags