每当我尝试使用get_date
函数时,它会忽略所有div并且正好在标题结尾之后放置 - 在<div class="entry-content">
<div class="entry-content">
May 16, 2014
<div class="blogleft">
<div class="mblog">
正在将其他功能正确放置在<div class="mblog">
内。
<div class="post-info">Posted on </div>
post-info
已正确嵌套在所有div下,但使用the_date()
生成的日期会一直返回。
function getblogpostsmain($atts, $content = null) {
extract(shortcode_atts(array(
'posts' => 1,
), $atts));
$return_string .= '<div class="mblog">';
query_posts (array('orderby' => 'date', 'order' => 'DESC' , 'showposts' => $posts));
if (have_posts()) :
while (have_posts()) : the_post();
$return_string .= '<h1 class="blog-title"><a href="'.get_permalink().'">'.get_the_title().' </a></h1>';
$return_string .= '<div class="post-info">Posted on '.the_date().'</div>';
$return_string .= '<p class="post-excerpt">' . get_the_excerpt() . '</p>';
endwhile;
endif;
$return_string .= '</div>';
wp_reset_query();
return $return_string;
}
?>
知道到底发生了什么事吗?我想出去了。 使用的主题:Vantage theme
答案 0 :(得分:2)
您正在使用the_date()
,当您需要的是一个返回日期的函数时,它会输出日期。
使用the_date()
交换get_the_date()
。
E.g:
$return_string .= '<div class="post-info">Posted on ' . get_the_date() . '</div>';