Q.カスタム投稿タイプ名「診療科目」「お知らせ」「FAQ」を変更したい
「診療科目」「お知らせ」はテーマのアップデートで、テーマオプションより変更が可能になりました。
外観>TCDテーマオプション>診療科目/お知らせ>アーカイブページの設定内で「その他の設定」の「タイトル」を変更ください。
カスタム投稿タイプ「診療科目」「お知らせ」「FAQ」の投稿タイプ名やスラッグを変更することはできますか?
A.下記のphpファイルの該当箇所を編集することで可能です。
スラッグはテーマオプションから変更してください。
①「診療科目」の変更
編集するファイル:functions.php
編集する箇所:
// カスタム投稿 「診療科目」を追加 ----------------------------------------------------------------
if ( function_exists('register_post_type') ) {
$options = get_design_plus_option();
if($options['course_slug']) {
$slug = sanitize_title($options['course_slug']);
} else {
$slug = 'course';
};
$labels = array(
'name' => __('Course', 'tcd-w'),
'singular_name' => __('Course', 'tcd-w'),
'add_new' => __('Add New', 'tcd-w'),
'add_new_item' => __('Add New Item', 'tcd-w'),
'edit_item' => __('Edit', 'tcd-w'),
'new_item' => __('New item', 'tcd-w'),
'view_item' => __('View Item', 'tcd-w'),
'search_items' => __('Search Items', 'tcd-w'),
'not_found' => __('Not Found', 'tcd-w'),
'not_found_in_trash' => __('Not found in trash', 'tcd-w'),
'parent_item_colon' => ''
);
②「お知らせ」の変更
編集するファイル:functions.php
編集する箇所:
// カスタム投稿 「お知らせ」を追加 ----------------------------------------------------------------
if ( function_exists('register_post_type') ) {
$options = get_design_plus_option();
if($options['news_slug']) {
$slug = sanitize_title($options['news_slug']);
} else {
$slug = 'news';
};
$labels = array(
'name' => __('News', 'tcd-w'),
'singular_name' => __('News', 'tcd-w'),
'add_new' => __('Add New', 'tcd-w'),
'add_new_item' => __('Add New Item', 'tcd-w'),
'edit_item' => __('Edit', 'tcd-w'),
'new_item' => __('New item', 'tcd-w'),
'view_item' => __('View Item', 'tcd-w'),
'search_items' => __('Search Items', 'tcd-w'),
'not_found' => __('Not Found', 'tcd-w'),
'not_found_in_trash' => __('Not found in trash', 'tcd-w'),
'parent_item_colon' => ''
);
③「FAQ」の変更
編集するファイル:functions.php
編集する箇所:
// カスタム投稿 「Q&A」を追加 ----------------------------------------------------------------
if ( function_exists('register_post_type') ) {
$options = get_design_plus_option();
if($options['faq_slug']) {
$slug = sanitize_title($options['faq_slug']);
} else {
$slug = 'faq';
};
$labels = array(
'name' => __('FAQ', 'tcd-w'),
'singular_name' => __('FAQ', 'tcd-w'),
'add_new' => __('Add New', 'tcd-w'),
'add_new_item' => __('Add New Item', 'tcd-w'),
'edit_item' => __('Edit', 'tcd-w'),
'new_item' => __('New item', 'tcd-w'),
'view_item' => __('View Item', 'tcd-w'),
'search_items' => __('Search Items', 'tcd-w'),
'not_found' => __('Not Found', 'tcd-w'),
'not_found_in_trash' => __('Not found in trash', 'tcd-w'),
'parent_item_colon' => ''
);
管理画面のメニュー「診療科目」「お知らせ」「FAQ」を変更したい場合は、’name’ の値をご変更ください。
URL等に表示されるスラッグを変更したい場合は、外観>TCDテーマオプション>診療科目/お知らせ/FAQ>基本設置>スラッグの設定 からご変更ください。
例)
'name' => __('●●●')
※パーマリンク変更を伴いますので、以前のスラッグは使用不可となります。
上記変更により404エラーが出た際は 設定>パーマリンク設定で変更を保存ボタンを押下します。(設定変更は不要で、ただ保存ボタンを押すだけで結構です。)
他テーマにおける同カスタマイズは下記もご参照ください。
この記事は役に立ちましたか?
もし参考になりましたら、下のボタンで教えてください。
今後の記事作成の参考とさせて頂きます!