0
我試圖找出爲什麼我的簡碼不工作 - 任何人都可以看到爲什麼(對於糟糕的格式化道歉,似乎無法得到這個簡碼才能正常顯示)?的WordPress:使用簡碼模板標籤和功能
代碼運行我上面的短代碼的某些原因。不知道我完全理解如何使用模板標籤/ WP功能的簡,我相信你需要以一個變量的簡內返回它在函數開始使用類似的get_。誰能幫忙?
感謝
OSU
/* News from Blog category only - category 3 */
add_shortcode('latestblogposts', 'osu_latestblogposts');
function osu_latestblogposts() {
$start = '<div class="widget widget_osu_blog">';
$start .= '<a title="Subscribe to our RSS feed" href="/feed?cat=3" class="rss"><img alt="RSS" src="' . get_bloginfo('template_directory') . '/images/ico-rss-big.png"></a>';
$start .= '<div>';
$my_query = new WP_Query('category=3&showposts=3');
while ($my_query->have_posts()) : $my_query->the_post();
$inner = '<div class="item"><a href="' . get_permalink() . '" title="';
$inner .= printf(esc_attr__('Permalink to %s', 'inspire'), the_title_attribute('echo=0'));
$inner .= '" rel="bookmark" class="title">' . the_title() . '</a>';
$inner .= '<p class="post-meta">';
$inner .= '<span class="small">by</span> <span class="post-author"><a title="Posts by ';
$inner .= the_author();
$inner .= '" href="' . the_author_posts_link() . '">' . the_author() . '</a></span>';
$inner .= '<span class="small">on</span> <span class="post-date">';
$inner .= get_the_date('d/m/Y') . '</span></p>';
$inner .= the_excerpt() . '</div> <!-- End div.item -->';
endwhile;
$end = '</div>';
$end .= '</div> <!-- End div.widget_osu_blog -->';
$latestblogposts = $start . $inner . $end;
return $latestblogposts;
}
你也需要改變 「the_excerpt()」 爲get_the_excerpt()。 – AJJ 2011-01-07 18:58:23