Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPBカップ
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPressナビゲーションメニューに投稿タイプアーカイブを追加する方法

最近、ある読者からWordPressのナビゲーションメニューにカスタム投稿タイプのアーカイブページへのリンクを追加できないかという質問を受けました。WordPressのアーカイブページは、特定の投稿タイプ、カテゴリー、タグの下にあるすべての投稿のリストを表示します。この投稿では、WordPressのナビゲーションメニューに投稿タイプのアーカイブを追加する方法を紹介します。

How to add custom post type archive link in navigation menus

WordPressのカスタム投稿タイプアーカイブ

WordPressでは、投稿タイプや タクソノミーカテゴリーやタグなど)のエントリーのリストを「アーカイブ」というキーワードで表します。

カスタム投稿タイプでアーカイブが有効化されている場合、それらをサイトに表示することができます。通常、カスタム投稿タイプのアーカイブページのURLはこのフォーマットになります:

http://example.com/post-type-slug/

投稿タイプのスラッグはカスタム投稿タイプの素敵な名前です。

例えば、私たちは’Deals’というカスタム投稿タイプを持っていて、このようなURLでアーカイブページを表示することができます:

https://www.wpbeginner.com/ja/deals/

カスタム投稿タイプのアーカイブページへのリンクをサイトのナビゲーションメニューに設置することができます。これにより、ユーザーはその投稿タイプで投稿された過去のすべてのエントリーを個別ページで見ることができます。

それでは、WordPressのナビゲーションメニューにカスタム投稿タイプのアーカイブページへのリンクを追加する方法を見ていきましょう。

ナビゲーションメニューにカスタム投稿タイプのアーカイブページへのリンクを追加する

まず、外観 ” メニューページにアクセスします。左のカラムにカスタム投稿タイプのタブがあります。

Custom post type tab on navigation menus screen in WordPress

カスタム投稿タイプの名前をクリックして展開し、「すべて表示」タブをクリックします。

投稿タイプのアーカイブのオプションが表示されます。その横にあるボックスにチェックを入れて、「メニューに追加」ボタンをクリックします。

カスタム投稿タイプのアーカイブが右カラムにメニュー項目として表示されます。

Post type archive menu item

初期設定では、カスタム投稿タイプの名前とアーカイブという単語がリンクラベルに使用されます。

これをもっと簡単なものに変更したいかもしれません。メニュー項目をクリックして編集し、ナビゲーションラベルを変更してください。

Menu label

メニューの保存ボタンをクリックして変更を保存することを忘れないでください。

これであなたのサイトにアクセスすると、ナビゲーションメニューにカスタム投稿タイプのアーカイブリンクが表示されます。

Custom post type link in WordPress navigation menu

投稿やページと同様に、投稿タイプの個別エントリーをナビゲーションメニューに追加することもできます。

エントリーを選択し、メニューに追加ボタンをクリックするだけです。

Adding single items from a post type to navigation menus

変更を保存するには、メニューの保存ボタンをクリックするのを忘れないでください。

カスタム投稿タイプがメニュー画面に外観されません。

カスタム投稿タイプが外観 ” メニューページに表示されるには、いくつかの必須条件に一致する必要があります。

まず、カスタム投稿タイプのアーカイブページが存在することを確認する必要があります。一般的には以下のようなURLです:

http://example.com/movies/

example.comを自分のドメイン名に、moviesを投稿タイプに置き換えてください。

このページであなたの投稿タイプのエントリーが表示される場合、あなたの投稿タイプはアーカイブをサポートしていますが、他の必須要件はサポートしていないことを意味します。

良いニュースは、カスタム投稿タイプのアーカイブページをカスタムリンクとして追加できることです。

外観 ” メニューページにアクセスし、「カスタムリンク」タブをクリックして展開します。

Adding a post type archive link as a custom link

URLフィールドにカスタム投稿タイプのアーカイブページのURLを入力し、リンクフィールドに表示したいラベルを追加します。

次に、メニューに追加ボタンをクリックすると、右カラムにカスタムリンクが表示されます。

Custom link item in navigation menu

メニューの保存ボタンをクリックして、変更を保存することができます。

この投稿が、WordPressのナビゲーションメニューに投稿タイプのアーカイブを追加する方法を学ぶのにお役に立てば幸いです。また、WordPressカスタム投稿タイプのチュートリアルで最も便利な12個のリストもご覧ください。

この投稿が気に入った場合は、WordPressの動画チュートリアルをYouTubeチャンネルに登録してください。Twitterや Facebookでもご覧いただけます。

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

アバター

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

9件のコメント返信を残す

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Vale

    Hello,
    I am kind of confused, didn’t we supposed to use our-category.php template and our-taxonomy.php archive pages? Or in this case we don’t need to create those custotom php loop/templates?
    Thank you

  3. Jordan

    Is there a way to do this but to carry over a parent in the URL? for example.. I create a CPT called /videos/. I add it to the menu under “our-projects”… so the url ends up being /our-projects/videos/

    Thanks!

  4. ratnesh

    how to add posts in different pages and similar posts to be displayed inhome page

  5. Roland

    “Custom post types need to match some requirements in order to be displayed on Appearance » Menus page.”

    What requirements are these then?

      • Radley Anaya

        Also note – if you change your custom post type you will likely need to update your permalinks.

  6. Amani Joseph

    Hi am a small website owner in Tanzania, wpbeginner help me from the day i start blogging to date. Am proud of my self to find this site and i will recommend this site to any WordPress beginner even pros, Today i have one Question i didn’t know where to ask and i think this is opportunity for you guys you can create the platform where we can i ask question about WordPress and other people or even you guys you can ask, This give the chance to find something to write to your blog. That say’d my question is i want to run something like deals like you do on the Deals section on this blog, can you recommend any plugin to do the work.

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。