I have two custom post types: news, films.

I need to recall both of them more ‘post’ (one of the default post type). I want the code works for ‘post’, ‘news’ and ‘films’ post types. I don’t know how to add or use the conditionals.

In the code I have two cases:

1) A part of code that says:

if ( 'post' === get_post_type() ) : 
endif; ?>

I need to add my custom post types and I tried:

if ( 'post','news','films' === get_post_type() ) : 
    endif; ?>


if ( array('post','news','films') === get_post_type() ) : 
        endif; ?>

Without success.

2) In this case the code is a bit different but similar and I need it works for the three post types not only for ‘post’:

'title_reply' => (get_post_type()=='post')? __( 'Leave a Comment', 'magazine' ):__( 'Add a Review', 'magazine' ) ,
'title_reply_to' => (get_post_type()=='post')?__( 'Leave a Reply to %s', 'magazine' ) :__( 'Add a Review to %s', 'magazine' ) ,

Thanks in advance , I appreciate your help.

Read more here: How to call two or three Post Types using get_post_type()


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: