Display multiple Custom post type in index

0

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:

    
asked by anonymous 25.09.2018 / 17:53

1 answer

0

Following the user's suggestion @Valdeir Psr

<?php if ( get_post_type( get_the_ID() ) == 'filmes' ) {
    echo 'postagens no custom post type filmes';
} elseif ( get_post_type( get_the_ID() ) == 'series' ) {
    echo 'postagens no custom post type series';
} elseif ( get_post_type( get_the_ID() ) == 'blog' ) {
    echo 'postagens no custom post type blog';
}
?>
    
25.09.2018 / 19:45