get custom post type

I am using this code to get custom posts in rows.

<?php query_posts('posts_per_page=72&cat=' . $cat . '&order=ASC');
$columns = 5;
$increment = 0;
?>
<table class="cat">
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
        <?php if($increment % $columns == 0){ // if increment is divisable by columns (ie 3/3 = 0))?>
        <tr>
            <td>
                <div class="post" id="<?php the_ID(); ?>">
                <div class="entry"><a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>"     title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_post_thumbnail( 'homepage-thumb' ); ?></a><br>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                </div>

                </div> <!-- .post -->
            </td>

        <?php
        }else{
        ?>
            <td>
                <div class="post" id="<?php the_ID(); ?>">
                <div class="entry"><a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_post_thumbnail( 'homepage-thumb' ); ?></a><br>
                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                </div>

                </div> <!-- .post -->
            </td>               

    <?php }$increment++; endwhile; endif;?>
</tr></table>

Problem is that it does not give custom posts. I want to use it on category page. How to amend first section so it automatically grabs posts from current category of either posts or custom post type.

Related posts

Leave a Reply

1 comment

  1. Using query_posts() you can pass 'post_type=custom-post-type' it will however not work with a category associated with default posts but instead you can pass the custom taxonomy name are the value taxonomy=taxonomy_value

    You’ll need to do something like:

    query_posts(array('post_type' => 'customposttype', 'posts_per_page' => 72,
    'custom_taxonomy_name' => 'custom_taxonomy_value', 'order' => 'ASC'));