开发者

Calling get_post_meta with custom fields in wordpress

I'm trying to enter a small piece of information that is created from a plugin to an area of my wordpress page that is called my a custom post.

The plugin that I'm using is FlippingBook WordPress Gallery Plugin (I have purchased a license)

After I create a book I put this code into my post: [book id='2' /] This works fine if I just place it in my post, but all of the other content of the page is entered via custom posts so this needs to be as well so it flows inline with the structure of the document.

So I am calling to enter this information like this:

开发者_Go百科        <div>
        <?php echo get_post_meta($post->ID, 'enter_page_flip_id', true); ?>
        </div>

But the [book id='2' /] no longer renders the book content, only text shows. Am I writing the custom post call incorrect?

The site: http://www.cicadabooks.co.uk/new/graphic-book-one/

Thanks much!


The Wordpress function to expand [shortcodes] into HTML is called do_shortcode. Try doing echo do_shortcode(get_post_meta(...)) and see if that helps.


The problem is that printing values from get_post_meta is different from calling the_content or some other built-in for displaying a post body. Those functions look for registered filters on their content and run those filters, which is how a plugin can find its shortcodes like [book] to replace.

One thing you might do is read the source of this plugin, find the code that replaces the shortcodes, and call that yourself from your template.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜