Custom field display on php if value
-
I’m trying to display a custom field, a summary, on pages that include a review box for my posts.
The bit of code that includes the review template if it is checked while making the post looks like this:
<?php $result_cmb_is_review = get_post_meta($post->ID, 'cmb_is_review', true); if ($result_cmb_is_review == 'checked') {include 'inc/template_review.php'; } ?>I’d like to add this code for a summary box after the review box in the post with this in it:
<h3><?php _e('Summary'); ?></h3> <p><?php get_field( "review_summary" ); ?></p>But I only want the Summary field to show up if the post is checked to be a review. I can’t seem to figure out how to get both the template and the custom field to show up only if the review is checked. Any tips would be wonderful.
The topic ‘Custom field display on php if value’ is closed to new replies.