`
$ previous_year = $ year = 0;
$ previous_month = $ month = 0;
$ ul_open = false;
$ myposts = get_posts(array(
'numberposts'=> $ numposts,
'orderby'=> 'post_date',
'order'=> 'DESC'
));
foreach($ myposts as $ post):?>
的http://本地主机/ klientasnew /档案/ = 01" >
`
答案 0 :(得分:0)
试试此代码
<?php $numposts = -1;
$previous_year = $year = 0;
$previous_month = $month = 0;
$ul_open = false;
$myposts = get_posts(array(
'numberposts' => $numposts,
'orderby' => 'post_date',
'order' => 'DESC'
));
?>
<?php foreach($myposts as $post) : ?>
<?php setup_postdata($post);
$year = mysql2date('Y', $post->post_date);
$month = mysql2date('n', $post->post_date);
$day = mysql2date('j', $post->post_date);
?>
<?php if ($year != $previous_year || $month != $previous_month) : ?>
<?php if ($ul_open == true) : ?>
<?php endif; ?>
<li><a id="df" rel="<?php echo get_the_date('m'); ?>" href="<?php echo
site_url();?>/archives?=<?php echo get_the_date('m'); ?>" onclick="return loadmore();">
<span><?php the_time('F Y'); ?></span></a>
</li>
<?php $ul_open = true; ?>
<?php endif; ?>
<?php $previous_year = $year; $previous_month = $month; ?>
<script type="text/javascript">
function loadmore(){
e.preventDefault();
var rml_post_id = jQuery(this).data( 'href' );
jQuery.ajax({
url : rml_post_id,
type : 'post',
data : {
post_id : rml_post_id
},
success : function( response ) {
//jQuery('#dd').html(response);
alert(response);
return false;
}
});
jQuery(this).hide();
}
</script>
<?php endforeach; ?>
答案 1 :(得分:0)
<?php $numposts = -1; <br>
$ previous_year = $ year = 0;
$ previous_month = $ month = 0;
$ ul_open = false;
$ myposts = get_posts(array(
'numberposts'=&gt; $ numposts,
'orderby'=&gt; 'POST_DATE',
'order'=&gt; 'DESC'
));?&GT;
$ year = mysql2date('Y',$ post-&gt; post_date);
$ month = mysql2date('n',$ post-&gt; post_date);
$ day = mysql2date('j',$ post-&gt; post_date);?&gt;