當我使用這個簡碼時,cat_titles
不在div
的內部? check out the examplePHP:shortcode不保留在div標記
function get_quote($atts) {
echo '<div id="le_quote">AquaPumps.Org is your online supplier of '.single_cat_title('', true).' Accessories, '.single_cat_title('', true).' Hoses and '.single_cat_title('', true).' Pumps. Use our selection to compare '.single_cat_title('', true).' models , specs and more. Buy '.single_cat_title('', true).' products at the best price possible today.</div>';
}
add_shortcode('random_quote', 'get_quote');
它應該是'return',你已經使用了'echo'。簡碼應該返回值,而不是'echo'。請檢查[參考](http://codex.wordpress.org/Function_Reference/add_shortcode)。 – Shazzad