• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

FOXWP

WordPressの始め方と使い方をわかりやすく解説!

  • HOME
  • WordPressブログの始め方
  • お問い合わせ
FOXWP / WordPress / Genesisのパンくずリストの表示を変更する方法

Genesisのパンくずリストの表示を変更する方法

最終更新日:2021年10月5日

StudioPressのWordPressテーマ「Genesis」のパンくずリストの表示を変更する方法です。

Genesis Frameworkの標準では、次のようにパンくずリストに内容と関係のない単語がついてしまいます。

Genesis標準のパンくずリストの表示
Genesis標準のパンくずリストの表示

紹介する方法を使うと、単語を変更したり、単語を削除したりできます。

目次 非表示
1 方法①:breadcrumbs.phpを編集する
2 方法②:functions.phpを編集する

方法①:breadcrumbs.phpを編集する

Genesis Frameworkのconfig/breadcrumbs.phpを編集します。

<?php
/**
 * Genesis Framework.
 *
 * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
 * Please do all modifications in the form of a child theme.
 *
 * @package StudioPress\Genesis
 * @author  StudioPress
 * @license GPL-2.0-or-later
 * @link    https://my.studiopress.com/themes/genesis/
 */

/**
 * The breadcrumbs configuration array.
 *
 * If child theme contains a `breadcrumbs.php` config, it will be used instead of this config.
 *
 * @since 2.7.0
 */
return [
	'home'                    => __( 'Home', 'genesis' ),
	'sep'                     => ' <span aria-label="breadcrumb separator">/</span> ',
	'list_sep'                => ', ',
	'prefix'                  => genesis_markup(
		[
			'open'    => '<div %s>',
			'context' => 'breadcrumb',
			'echo'    => false,
		]
	),
	'suffix'                  => genesis_markup(
		[
			'close'   => '</div>',
			'context' => 'breadcrumb',
			'echo'    => false,
		]
	),
	'heirarchial_attachments' => true,
	'heirarchial_categories'  => true,
	'labels'                  => [
		'prefix'    => __( 'You are here: ', 'genesis' ),
		'author'    => __( 'Archives for ', 'genesis' ),
		'category'  => __( 'Archives for ', 'genesis' ),
		'tag'       => __( 'Archives for ', 'genesis' ),
		'date'      => __( 'Archives for ', 'genesis' ),
		'search'    => __( 'Search for ', 'genesis' ),
		'tax'       => __( 'Archives for ', 'genesis' ),
		'post_type' => __( 'Archives for ', 'genesis' ),
		'404'       => __( 'Not found: ', 'genesis' ),
	],
];

方法②:functions.phpを編集する

functions.phpに以下のコードを追記します。

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

//* Modify breadcrumb arguments.
add_filter( 'genesis_breadcrumb_args', 'sp_breadcrumb_args' );
function sp_breadcrumb_args( $args ) {
	$args['home'] = 'Home';
	$args['sep'] = ' / ';
	$args['list_sep'] = ', '; // Genesis 1.5 and later
	$args['prefix'] = '<div class="breadcrumb">';
	$args['suffix'] = '</div>';
	$args['heirarchial_attachments'] = true; // Genesis 1.5 and later
	$args['heirarchial_categories'] = true; // Genesis 1.5 and later
	$args['display'] = true;
	$args['labels']['prefix'] = 'You are here: ';
	$args['labels']['author'] = 'Archives for ';
	$args['labels']['category'] = 'Archives for '; // Genesis 1.6 and later
	$args['labels']['tag'] = 'Archives for ';
	$args['labels']['date'] = 'Archives for ';
	$args['labels']['search'] = 'Search for ';
	$args['labels']['tax'] = 'Archives for ';
	$args['labels']['post_type'] = 'Archives for ';
	$args['labels']['404'] = 'Not found: '; // Genesis 1.5 and later
return $args;
}

参考:StudioPressのModify the Breadcrumbs Displayより

カテゴリー:WordPress タグ:Genesis

WordPress初心者の方に読んで欲しい記事

  • あとで後悔しない!WordPress初期設定の基本事項
  • 安全にサイトを運営しよう!WordPressセキュリティ対策の基本マニュアル
Previous Post: « WordPressプラグインに付与したGoogleアカウントへのアクセス権を削除する方法
Next Post: WordPressで使用されているプログラミング言語は5つ|各言語の特徴や学習方法を解説 »

Primary Sidebar

世界で一番利用されているWordPressテーマ

Divi WordPress Theme
レビューを見る

あなたの悩みは?

WordPress
セキュリティ
WordPress
トラブル
アクセスアップアフィリエイト
おすすめASP

最新ニュース

  • 【カラフルボックス】夏のキャンペーン実施中【2021年8月31日まで】

最近の投稿

  • WordPressでおすすめのバックアッププラグイン5選
  • WordPressのPHP設定を変更する方法(php.ini)
  • WordPressでおすすめの画像圧縮プラグイン5選
  • WordPressの投稿編集画面でその投稿を表示する方法
  • WordPressの管理画面に再利用ブロックの管理を追加する方法

カテゴリー

  • WordPress
  • お役立ち情報
  • アフィリエイト
  • ドメインレジストラ
  • レンタルサーバー
    • ColorfulBox
    • Conoha WING
    • mixhost
    • さくらのレンタルサーバー
    • エックスサーバー
    • エックスフリー
    • ロリポップ!
  • 便利ツール
WordPress学習方法
トップページへ

プライバシーポリシー|お問い合わせ
Copyright © 2023 FOXWP All rights reserved.