我如何在wordpress以外的地方獲得簡碼?如何在WordPress之外獲得簡碼?
這是我的代碼
<?php
require($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');
$args = array(
'posts_per_page' => 10 // Specify how many posts you'd like to display
);
$latest_posts = new WP_Query($args);
if ($latest_posts->have_posts()) {
while ($latest_posts->have_posts()) {
$latest_posts->the_post();
if (preg_match_all ("#\[scode\](.+)\[\/scode\]#", the_content(), $matches, PREG_SET_ORDER)) {
echo $matches[1];
};
?>
,這是我的內容
[scode]hare is my shortcode[/scode]
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book
任何人都可以幫助... PLZ
只需撥打該簡碼掛的功能和它傳遞的參數,你通常會通過簡碼來完成。更好的問題是,爲什麼你需要在WordPress之外顯示這些帖子?我敢打賭,你可以創建一個自定義模板來滿足你的需求。 –