Special query for custom Post-Type…Difficult, please help!
-
Hey everybody,
So first, I tell you what I want to do. I want to query all the posts from my Custom-Post-Type which is named “work”. And I want to Paginate them…means I want to have Pagination.
Later on, maybe when this step works, I also want to show only posts from a special Taxonomy. But for now the Pagination is the important part.
That’s the code I tried my best on so far:
<?php
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$args=array(
‘post_type’ => ‘work’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => 16,
‘caller_get_posts’=> 1,
‘paged’=>$paged
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?><div class=”workposts”>
” title=”<?php the_title() ?>”><?php $image = get_post_meta($post->ID, “Image1”, true); echo $image; ?>
<h3>” title=”<?php the_title() ?>”><?php the_title() ?></h3>
<?php $subtitle = get_post_meta($post->ID, “Subtitle”, true); echo $subtitle; ?>
</div><?php endwhile; } ?>
<div class=”navigation”>
<div class=”alignleft”><?php previous_posts_link(‘« Previous’) ?></div>
<div class=”alignright”><?php next_posts_link(‘More »’) ?></div>
</div>But it just does not work. Any suggestions or ideas ? It would be sooooo cool of you to help me. Thank you very much,
joeybottle
- The topic ‘Special query for custom Post-Type…Difficult, please help!’ is closed to new replies.