Warning: Undefined array key 0 in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 406

Warning: Attempt to read property "parent" on null in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 407

Warning: Attempt to read property "term_id" on null in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 413

Warning: Attempt to read property "cat_name" on null in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 413

カスタムヘッダー機能を利用する


Warning: Undefined variable $pre in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 517

Warning: Undefined variable $pre in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 517

Warning: Undefined variable $pre in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 517
wordpress

カスタムヘッダーとは

カスタムヘッダーとはサイトヘッダーを管理画面から自由に変更できる機能です。 あらかじめ有効になっていないテーマもありますが、functions.PHPを修正することで機能が使えるようになります。

サイトのテーマを直接弄ることが出来るなら無用の機能ですが、そうでない場合もあります。 そんな時にサイトの顔とも言えるヘッダーをコード知識なしで変更できる機能なのです。

カスタムヘッダー機能を有効化する

function.PHPに以下の記述をすることでカスタムヘッダー機能が有効になります。

引数なしver(デフォルト設定を使用)

dd_theme_support( 'custom-header');

引数ありver

args = array(
  'default-image'          => '',
  'random-default'         => false,
  'height'                 => 0,
  'width'                  => 0,
  'flex-height'            => false,
  'flex-width'             => false,
  'default-text-color'     => '',
  'header-text'            => true,
  'uploads'                => true,
);
add_theme_support( 'custom-header', $args);
引数意味指定例
default-imageデフォルト画像のパスget_bloginfo(‘template_url’).’/image/header.jpg’
random-defaultヘッダー画像をランダム表示true
height画像の高さ960px
width画像の横幅200px
flex-heightアップロード画像高さがheightと違う場合トリムするtrue
flex-widthアップロード画像幅がheightと違う場合トリムするtrue
default-text-colorヘッダーのテキストカラー#000000
header-text画像上にテキストを入れるtrue
uploadsファイルのアップロード許可true

記述すると管理画面の[外観]に[ヘッダー]の項目が追加されます。 ここからカスタムヘッダー画面に入ります。それではヘッダー画像をアップロードしましょう。

アップロードしたヘッダー画像を表示する

  <a href="">
  <img src="" width="width; ?>" height="height; ?>" alt="header">
  </a>

  <a href="">
    
  </a>


Warning: Undefined variable $category in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/content.php on line 79

Warning: Attempt to read property "name" on null in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/content.php on line 79

の記事

eyecatch

インターネット入門‐そもそもインターネットって何?

eyecatch

HTMLとは

eyecatch

ウェブブラウザの基礎知識

eyecatch

CSSとは

eyecatch

WordPressで「データベース接続確立エラー」が起きた時の対処と対策

eyecatch

セクションとアウトライン


Warning: Undefined variable $category in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/content.php on line 84

Warning: Attempt to read property "count" on null in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/content.php on line 84
HOME