Custom fields values in Shortcode outside the loop (1 post)

  1. lontanodagliocchi
    Posted 6 years ago #

    Hi! im using the "review box" plugin, with a shortcode like this:

    [review pros="sample text" cons="sample text" verdict="sample text" score=77]

    that generate a formatted table.
    This shortcode must to be used in a post or a page, but i want to use it outside the loop, in single.php, cause i need to replace the "sample text" with values of custom fields.

    Now i'm tryng some code like this:

    <?php echo do_shortcode('[review pros="<?php echo get_post_meta($post->ID, "Pros", true); ?>" cons="<?php echo get_post_meta($post->ID, "Cons", true); ?>" verdict="<?php echo get_post_meta($post->ID, "Verdict", true); ?>" score=<?php echo get_post_meta($post->ID, "Score", true); ?>]'); ?>

    that generate the table but without results...
    how i can wrote this? it's a sintax problem? Please,help me! :)

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 6 years ago by lontanodagliocchi
  • This topic is not resolved
  • WordPress version: 2.9