Forums

Custom field inside do_shortcode??? (2 posts)

  1. nikhu07
    Member
    Posted 8 months ago #

    Hi, I am creating a post template for my wordpress. I have got all the code working fine but I want to run custom field inside do_shortcode, How could I do it???

    <?php echo do_shortcode('[tabs style="1"]
    
    [tab title="Specifications"]
    
    [table id=1 /]
    
    [/tab]
    
    [tab title="In the News"]
    
    [RSSImport display="20" feedurl="http://thedripple.com/tag/sony-xperia-j/feed/"]
    [/tab]
    
    [/tabs]'); ?>

    See the RSS Import, inside it i have manually assigned the feedurl value, but I want to get it from custom field!
    I know I can use the following to show custom field value but how could I run the code there??

    <?php echo get_post_meta($post->ID, “FeedURL”, true); ?>
  2. You need to create a shortcode using the Shortcode API http://codex.wordpress.org/Shortcode_API

    your callback function should return get_post_meta( $post->ID, "FEEDURL", true);

Reply

You must log in to post.

About this Topic