Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

@Ficus

【WordPress・プラグインなし】デフォルトの「投稿」(post)のアーカイブページを作成する方法

デフォルトの「投稿」(post)のアーカイブ(記事一覧)ページは無効になっているため有効化します。

functions.php
function post_has_archive($args, $post_type){
    if('post' == $post_type){
        $args['rewrite'] = true;
        $args['has_archive'] = 'news'; //任意のスラッグ名
    }
    return $args;
}
add_filter('register_post_type_args', 'post_has_archive', 10, 2);

:heavy_plus_sign: 設定 > パーマリンク設定 > 変更を保存

この設定の場合は、http://サイトURL/news/でpostの一覧ページが表示できます。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
0
Help us understand the problem. What are the problem?