カスタム投稿タイプの条件付きクエリを作成しようとしています。ただし、特定の投稿に関連する必要があります。たとえば、すべてのプロジェクトで機能する現在のコードがあります。
<?php if ('project' == get_post_type() ) { ?>
// Get content
<?php } ?>
ただし、ID 75 で特定のプロジェクトを指定できるようにする必要があります。これは可能ですか?
どんな助けでも大歓迎です。
乾杯、
if($post->post_type == 'type your post type here' ) :
//Get Content
endif;
これは機能しています...
get_the_ID()
LOOP 内で関数を使用できます:
http://codex.wordpress.org/Function_Reference/get_the_ID
<?php if ('project' == get_post_type() && get_the_ID() == 75) { ?>
// Get content
<?php } ?>