WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Custom Field Template] using PHP in the_content() hook

[Plugin: Custom Field Template] using PHP in the_content() hook

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can not separate the php codes if you have conditional statements like if. So this does NOT work:

    <?php if ( get_post_meta($post->ID, 'your_key_name', true) ) { ?>
    <?php echo get_post_meta($post->ID, "your_key_name", $single = true); ?>
    <?php } ?>

    This does work:

    <?php if ( get_post_meta($post->ID, 'your_key_name', true) ) {
    echo get_post_meta($post->ID, "your_key_name", $single = true);
    } ?>

    Please try it out.

    egordin

    @egordin

    Hiroaki,

    This code you provided does not seem to work neither in the CFT shortcodes formatting box nor the Autohook content box (I did replace your_key_name with both [my_key_name] and my_key_name.

    Can you clarify how to get this to work, or add the ability to ignore/hide empty custom fields?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Custom Field Template] using PHP in the_content() hook’ is closed to new replies.