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ナビゲーションメニューにタイトル属性を追加する方法

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

WordPressのナビゲーション・メニュー項目にタイトル属性を追加したいですか?

title属性は、メニュー項目に関する追加情報を提供します。ユーザーのマウスがリンクの上に移動すると、ツールチップテキストとして外観が表示されます。

この投稿では、クラシックテーマとブロックテーマの両方で、WordPressナビゲーションメニューにタイトル属性を追加する方法を紹介します。

How to Add Title Attribute in WordPress Navigation Menus

ナビゲーションメニュー項目にタイトル属性を追加する理由

WordPressでは、HTML要素をよりよく説明するためにtitle属性を追加することができます。これは、ユーザーがマウスオーバーしたときにツールチップとして表示される追加情報を提供するために、リンクや画像でよく使用されます。

これは、画像のタイトル属性をツールチップに表示した例です。ユーザーは画像の上にマウスを移動させることで、画像に関するさらに詳しい情報を知ることができます。

An image with the title text

さらに詳しくは、画像のaltテキストとタイトルの違いについてのガイドをご覧ください。

また、投稿にリンクを追加する際は、title属性を使用することをお勧めします。これにより、ユーザーはリンクをクリックする前に、そのリンクがどこに飛ぶのかを確認することができます。

SEOの専門家の中には、リンク属性が検索エンジン最適化(SEO)に役立つと考える人もいる。

title属性は、視覚障害ユーザーが使うスクリーン・リーダーでも読み上げられるかもしれません。しかし、しばしば無視され、代わりにアンカー・テキストが読まれます。

ということで、WordPressのナビゲーション・メニューにtitle属性を追加する方法を見ていきましょう。以下のリンクから、あなたのテーマに合った方法にジャンプできます:

クラシックテーマのメニュー項目にタイトル属性を追加する

クラシックWordPressテーマを使用している場合、ダッシュボードの外観 ” メニューからナビゲーションメニューをカスタマイズすることができます。

しかし、初期設定ではメニュー項目にtitle属性を追加することはできません。

この機能を追加するには、画面の右上にある「表示オプション」タブをクリックする必要があります。するとメニューが表示されますので、「タイトル属性」設定の隣にあるチェックボックスをクリックしてください。

Enabling Image Attributes in Screen Options

これにより、メニューエントリーを作成または編集する際に、タイトル属性フィールドが追加されます。

これで、既存のメニューの項目をスクロールダウンしてクリックし、展開することができます。タイトル属性フィールドが表示されます。

Adding a Title Attribute to a Classic Theme Menu Item

タイトルとして使用したいテキストを追加することができます。また、他のメニュー項目を展開して、タイトル属性を追加することもできます。

ページ下部の「メニューを保存」ボタンをクリックし、変更内容を保存することをお忘れなく。

WordPressのサイトにアクセスし、ナビゲーション・メニューのリンクにマウスを乗せると、タイトル属性がツールチップとして表示されます。title属性がツールチップとして表示されます。

Preview of a Menu Entry Title Attribute When Using a Classic Theme

ブロックテーマのメニュー項目にタイトル属性を追加する

ブロックテーマを使用している場合、フルサイトエディターを使ってナビゲーションメニューをカスタマイズすることができます。このエディターでは初期設定でメニュー項目にタイトル属性を追加することができます。

まず、WordPress管理エリアの外観 ” エディターに移動し、「ナビゲーション」オプションをクリックしてメニューを見つけます。

Go to the Navigation Section of the Full Site Editor and Select a Menu

リストから編集したいメニューを選択する必要があります。

左側のプレビューペインをクリックすると、エディターがフルスクリーンで表示されます。左側の設定ペインが表示されていることを本当に〜してもよいですか?表示されていない場合は、画面上部の「設定」ボタンをクリックして表示できます。

Click a Menu Entry in the Settings Pane

次に、設定ペインで編集したいメニュー項目をクリックします。タイトル属性を含む、そのエントリーのオプションが表示されます。

タイトル属性」フィールドにタイトルを入力するだけです。

Add a Tiitle Attribute in the Settings Pane

画面上部の「保存」ボタンをクリックして、新しい設定を保存してください。確認のため、もう一度「保存」ボタンをクリックする必要があります。

では、あなたのサイトにアクセスして、メニューのタイトル属性を実際に見てみましょう。

Preview of a Menu Entry Title Attribute in a Block Theme

WordPressナビゲーションメニューカスタマイズのエキスパートガイド

ナビゲーションメニューにtitle属性を追加する方法がわかったところで、WordPressのナビゲーションメニューのカスタマイザーに関する他の投稿もご覧ください:

このチュートリアルで、WordPressのナビゲーションメニューにtitle属性を追加する方法を学んでいただけたら幸いです。また、ブログのトラフィックを増やす方法やWordPressのお問い合わせフォームプラグインのエキスパートセレクションもご覧ください。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

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

Avatar

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

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

  1. Syed Balkhi says

    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. Moinuddin Waheed says

    I find it interesting to know that seo is more human than we are and it has more consideration for all than we do.
    I mean when we do seo taking care of title and alt tags and we try to make sure it optimizes on seo parameters, it in turn lets screen readers to view and read clearly.
    I didn’t know that menu options also does have option for title attribute. thanks for this addition.

  3. Ralph Miller says

    This was incredibly helpful. I didn’t know there was a menu for screen options. My title attribute had disappeared and this absolutely helped me find it. Thank you!

  4. Fifa says

    I don’t know why all the praises here but I’ve tried to follow a few of instructions from this site and NOTHING WORKS.

  5. Jim says

    Wow, thank you! I’ve been tearing my hair out all day trying to inject the title attribute with the nav_menu_link_attributes, Nothing would work. This was so easy and worked great. I had no idea all that stuff was hidden in Screen Options. Thanks again!

  6. Linda Paul says

    This did not work at all for me. In the example screen shots you say to scroll down and click any menu item and expand it. The screen shot clearly shows URL, Navigation Lable, Title Attribute. But when I expand the menu item I want to edit, there IS NO URL associated with it. I am trying to make this one category read in ascending order (oldest to newest.)

返信を残す

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