这里是code.i不知道为什么它在摘录中显示参数详细信息的详细信息我附加了屏幕截图。!所有代码工作正常。有输出 " 1 参数$ tag(string)(必需)要在帖子内容中搜索的短代码标签默认值:无$ func(可调用)(必需)在找到短代码时挂起运行默认值:无返回值(无)示例en savoir plus。 "
function bartag_func($atts)
{
extract(shortcode_atts(array(
'category_name' => 'name',
'orderby' => 'date',
'order' => 'DESC',
// 'cat' => 'id',
'post_status' => 'publish',
'posts_per_page' => '5',
) , $atts, 'bartag'));
$arg = array(
'category_name' => $category_name,
'orderby' => $orderby,
'order' => $order,
// 'cat' => 'id',
'post_status' => $post_status,
'posts_per_page' => $posts_per_page
);
$my_query = new WP_Query($arg);
if ($my_query->have_posts())
{
while ($my_query->have_posts()):
$my_query->the_post();
$output.= '<div id="service-hp">' . get_the_post_thumbnail('home-thumb') . '<h2 style="margin-bottom:5px">' . get_the_title() . '</h2>' . get_the_excerpt() . '<a class="read-more" href="' . get_permalink() . '">en savoir plus <img src="' . get_bloginfo('template_url') . '/images/read-more.png"></a></div><!-- ends here -->';
endwhile;
}
wp_reset_query();
return $output;
}
add_shortcode('bartag', 'bartag_func');