If conditional for meta key?
-
Hello,
I have custom post type NEWS (single-news.php). In post type NEWS i created a new custom meta key uk_news_info.
I’m using this code for display if/else conditional for custom meta key uk_news_info:
<?php if ( get_post_meta( get_the_ID(), 'uk_news_info', true ) ) : ?> <!--text/code--> <?php endif; ?>
Everything work fine.
In post type POST (single.php), i want retrieve this meta key uk_news_info from post type NEWS. I’m using this code >> https://pastebin.com/3c16yFvf
And everything work good.My question is, how to create if conditional for this situation https://pastebin.com/3c16yFvf in post type POST or single.php file?
I mean, if empty meta key uk_news_info in post type NEWS with post id 123, dont show that code.Can someone help me, please!
Thank you.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘If conditional for meta key?’ is closed to new replies.