Title: shortcode help &#8211;
Last modified: October 1, 2018

---

# shortcode help –

 *  Resolved [callender](https://wordpress.org/support/users/jimcallender/)
 * (@jimcallender)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-help-18/)
 * Hi guys,
 * What is required to show shortcode? I have the following, but is not parsing.
   Ideally, the shortcode can be changed within wp admin, at page level, so I cannot
   hardcode it in the page template. Thanks for your help.
 *     ```
                   <?php while ( have_posts() ) : the_post(); ?>
                        <?php the_content( ); ?>
   
                         <?php $cmb_f  = get_post_meta( get_the_ID(), 'panel_box_descf3', true );
               					echo esc_html( $cmb_f ); ?>
   
                     <?php endwhile; // end of the loop. ?>
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fshortcode-help-18%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [callender](https://wordpress.org/support/users/jimcallender/)
 * (@jimcallender)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-help-18/#post-10740363)
 * OK i have created this –
 * Let me know if there is a better solution? thanks!
 * <?php $cmb_f = get_post_meta($post->ID, ‘panel_box_descf2’, true); ?>
    <?php 
   if( $cmb_f ) { echo do_shortcode( $cmb_f ); } else { echo ‘$meta was empty’; }?
   >
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-help-18/#post-10740459)
 * One thing to keep in mind with shortcodes is that they need to return their output,
   not echo it. If you’ve ever seen lines of code like `ob_start()` and `return 
   ob_get_contents()` in shortcodes this is why. Those examples would be using output
   buffering to catch like a screen filter and return its final results.
 * Beyond that, I think you’re not horribly off track, and something like get_the_ID()
   should work because the post globals at that point would be theoretically set
   for the right post.
 * Beyond that, are the shortcodes being dropped in to the post editor? or are they
   in your loop by chance? Asking because it’s slightly odd to be appearing to be
   running your standard loop inside your shortcode, which would be part of your
   loop.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘shortcode help –’ is closed to new replies.

 * ![](https://ps.w.org/cmb2/assets/icon.svg?rev=2866672)
 * [CMB2](https://wordpress.org/plugins/cmb2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmb2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmb2/)
 * [Active Topics](https://wordpress.org/support/plugin/cmb2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmb2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmb2/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-help-18/#post-10740459)
 * Status: resolved