I was wondering to know if it’s possible to use global posts with custom_types. I was working with this function:
global $post;
$myposts = get_posts('numberposts=4&offset=1& category=3,4');
foreach($myposts as $post) :
setup_postdata($post); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Visualizza <?php the_title(); ?>"><img src="<?php echo get_option('home'); ?>/wp-content/uploads/posthumb/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="<?php the_title(); ?>" /></a>
<?php endforeach;
As soon as I’ve moved the post from the standard articles type to a new custom post type, this stopped working. The category is still the same. Can I get it work again in any kind of way?
Thank you very much for your reply.
By default
get_posts()
uses a default post type ofpost
.If you want to select from a CPT then you need this: