I have a Wordpress template with multiple post type, and I can do the query and display all the custom post type in the index.
My Custom post type is an area reserved only for Movies, Series and Blog, but in my index I only show Movies and Series because they appear the same.
Ex. as it appears in my index:
HowdoIpostmyblogpost:
Butmydoubtandthefollowing,asIcanshowallthesepostinmyindex,type,Iuseadifferenttemplateintheblogarea,Ishowonlyoneimageandonedescription,alreadyinmyareaofmoviesandseriesIIshowvariousinformation.
HowdoIdistinguishtheposttodisplayallintheindexandwithoutgettingboggeddown?
<?php$args=array('post_type'=>array('filmes','series'));query_posts($args);if(have_posts()):while(have_posts()):the_post();?><?phpif(has_post_thumbnail()){$imgsrc=wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'home');$imgsrc=$imgsrc[0];}elseif($postimages=get_children("post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=0")) {
foreach($postimages as $postimage) {
$imgsrc = wp_get_attachment_image_src($postimage->ID, 'home');
$imgsrc = $imgsrc[0];
}
} elseif (preg_match('/
<img [^>]*src=["|\']([^"|\']+)/i', get_the_content(), $match) != FALSE) {
$imgsrc = $match[1];
} else {
$imgsrc = get_template_directory_uri() . '/images/no-imagen.png';
} ?>
I know that to display the posts of the blog area just add in the array after the post_type, but when it appears it gets bugged the display part.
Ex: