我的代码主题存档。php是
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( \'content\', \'test\' get_post_format() );
?>
<?php endwhile; ?>
<?php semplicemente_paging_nav(); ?>
<?php else : ?>
<?php get_template_part( \'content\', \'none\' ); ?>
<?php endif; ?>
所以我想把订单从desc改为acs,orderby date和post per page是100。
我找到了。
$args = ( array(
\'order\' => \'ASC\',
\'orderby\' => \'date\',
\'posts_per_page\' => \'100\',) );
所以我把$args放在get\\u post\\u format()上,\\u post()放什么都没发生?
有什么想法吗?
谢谢你的帮助
最合适的回答,由SO网友:SevenT 整理而成
谢谢你的帮助。现在我更加关注函数。php,所以我的旧代码有效。
/* Change page order */
add_filter( \'pre_get_posts\' , \'my_change_order\' );
function my_change_order( $query ) {
// Check if the query is for an archive
if($query->is_archive)
// Query was for archive, then set order
$query->set( \'order\' , \'asc\' );
// Return the query (else there\'s no more query, oops!)
return $query;
}
// Code no paging//
function no_nopaging($query) {
if (is_date()) {
$query->set(\'nopaging\', 1);
}
}
add_action(\'parse_query\', \'no_nopaging\');