PSWPTools

投稿日:2022-09-23 投稿者:PS カテゴリ:ソフト タグ: , , , ,

WordPressでのテーマ作成で、よく使用する処理をまとめたモジュール。

仕様

functions.php への組み込み

<?php // 例
include('psc_wptools.php');
$wpt = new PSWPTools();

オプション

Option初期値備考
titletruetrue/falsehead 内に title タグを入れるかどうか
title_sepfalsefalse/stringstitle タグ内の区切り文字を変更する場合、その文字を指定。(WP初期値「 – 」)
descriptiontruetrue/falsehead 内に description を出力するか
jquerytruetrue/falseWP内に準備されている jQuery を読み込むかどうか
jsfalsefalse/stringsテーマの独自の JavaScript を組み込む場合、パスを指定
css“style.css”false/stringsテーマの独自の css を組み込む場合、パスを指定
widgetstruetrue/falseWPのウィジェットを使用するかどうか
thumb[“post”]Arrayサムネイル画像の登録を許可する箇所(’post’:投稿 ’page’:固定ページ)
block_editor_cssfalsefalse/stringsブロックエディタ用の css を指定する場合、パスを指定
shortcode_ignoretruetrue/Array部分非表示機能( [[ignore]、[/ignore]] のショートコード)を使用する場合、設定に定義する。
category_addfieldfalsefalse/stringsカテゴリに設定項目を追加する
tag_addfieldfalsefalse/stringsタグに設定項目を追加する

定義ファイル

以下の順に探し、最初に見つかったものを使用する。

  1. /wp-content/uploads/ファイル名
  2. /wp-content/themes/テーマ名/ファイル名