0
我有一個簡碼,我把我的帖子,但不知何故它不會執行一些重播。下面是我的代碼有:ShortCode WordPress的不工作
short-code.php
:
add_shortcode('teammate',function($atts){
$classes=$atts['country'];
$imgUrl=$atts['img'];
$name=$atts['name'];
$description=$atts['description'];
echo '
<div class="member "'.$classes.'>
<div class="member-img">
<img src="'.$imgUrl.'">
</div>
<div class="member-desc">
<h1>'.$name.'</h1>
<p>'.$description.'</p>
</div>
<div class="clear"> </div>
</div>
';
});
這裏是我包括在functions.php
文件:
$includes = array(
'includes/theme-options.php', // Options panel settings and custom settings
'includes/theme-functions.php', // Custom theme functions
'includes/theme-actions.php', // Theme actions & user defined hooks
'includes/theme-comments.php', // Custom comments/pingback loop
'includes/theme-js.php', // Load JavaScript via wp_enqueue_script
'includes/sidebar-init.php', // Initialize widgetized areas
'includes/theme-widgets.php', // Theme widgets
'includes/short-code.php', // Custom shortcode file for side menu
'includes/team.php' //team shortcode
);
這裏是我把我的頁面:
<div class="outer-members">
<div class="inner-members">
[teammate name="Darko Petkovski" img="http://myurl.com/myimage.jpg" description="test" country="mc"]
</div>
</div>
嗨,首先,你的答案似乎是真的增加了關於這個問題的信息,所以也許你應該把它編輯成你的問題。其次,你的意思是'短代碼不在wp外執行? –
你的意思是在你的文章之外,在模板文件的某個地方? – harsh8888
我在wp之外有一個html頁面,但在同一臺服務器上。所以我通過發佈帖子來獲取帖子內容,然後通過使用'do_shortcode()'來發布短信內容。 –