繁体   English   中英

WordPress:按日期升序更改标签的网址和顺序

[英]WordPress: change a tag's url and order by date in ascending manner

我的WordPress网站中有以下标记:

http://www.example.com/tag/collection-100

并且我想将标签的网址更改为http://www.example.com/legends ,并使该页面上显示的帖子在以降序显示的同时按日期升序排列。

我搜索了可以做到这一点的插件,但在WordPress网站上找不到任何插件。

我也尝试过创建一个新模板,并在其中使用以下代码:

query_posts( 'tag=collection-100&order=ASC' );

会获取前18个帖子,但分页无法正常工作,而是始终显示前18个帖子。

任何帮助,不胜感激:)

创建一个类似“ example-template.php”的自定义模板,并编写如下查询:

get_header();

$loop = new WP_Query( array( 'post_type' => 'your-post-type',  'orderby' => 'date', 'order' => ASC ) ); 

while ( $loop->have_posts() ) : $loop->the_post(); 
    //print your needs
endwhile;

get_footer();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM