2013-05-01 94 views
0

我需要你的幫助,正如我在標題中提到的那樣,我希望使用簡單文本字段內的射擊代碼作爲自定義字段(屬於簡單字段WordPress插件)現在它不執行到在一個簡單字段(自定義字段)內執行簡碼

[caption]Testing[/caption]中的HTML格式..while我已經做字幕的回報..

任何解決方案將高度讚賞..here是我想用短代碼使用HTML ..

<div class="box_wrap clearfix"> 
    <div clas="heading"> 
    Call to Action 
    </div> 
    <div class="box"> 
    &nbsp; 
    </div> 
</div> 

我知道怎麼說ca n我通過在自定義文本字段中對此進行簡碼來執行此HTML!1

謝謝!

回答

0

當顯示the_content,短碼API將任何 註冊簡碼解析例如「[myshortcode]」,獨立和解析 屬性和內容,如果有的話,並通過他們相應 簡碼處理函數。由 短代碼處理程序返回(未回顯)的任何字符串將被插入到帖子主體中,而不是自己的短代碼 。

。換句話說,你需要申請the_content過濾器,你輸出模板內容。

所以不是有這樣的代碼:

echo get_post_meta(get_the_ID(), 'your_meta_key', true); 

使用這個代替:

// Get your custom meta data using get_post_meta() function 
$meta_content = get_post_meta(get_the_ID(), 'your_meta_key', true); 

// Then we need to apply 'the_content' filter on the $meta_content 
echo apply_filters('the_content', $meta_content); 

而且你的簡碼,應考慮在內。如果您已經註冊即短碼...

瞭解更多關於:
- Shortcode API here
- the_content filter here
- apply_filters() function here.