最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Adding theme support for a custom header image

programmeradmin4浏览0评论

I'm using add_theme_support( 'custom-header', $defaults ); to support custom header images in my theme. The $defaults are described in the Custom Headers article

$defaults = array(
    'default-image'          => '',
    'random-default'         => false,
    'width'                  => 0,
    'height'                 => 0,
    'flex-height'            => false,
    'flex-width'             => false,
    'default-text-color'     => '',
    'header-text'            => true,
    'uploads'                => true,
    'wp-head-callback'       => '',
    'admin-head-callback'    => '',
    'admin-preview-callback' => '',
);

There is no explanation in the Codex for the following. What do they mean?

  • wp-head-callback
  • admin-head-callback
  • admin-preview-callback

I'm using add_theme_support( 'custom-header', $defaults ); to support custom header images in my theme. The $defaults are described in the Custom Headers article

$defaults = array(
    'default-image'          => '',
    'random-default'         => false,
    'width'                  => 0,
    'height'                 => 0,
    'flex-height'            => false,
    'flex-width'             => false,
    'default-text-color'     => '',
    'header-text'            => true,
    'uploads'                => true,
    'wp-head-callback'       => '',
    'admin-head-callback'    => '',
    'admin-preview-callback' => '',
);

There is no explanation in the Codex for the following. What do they mean?

  • wp-head-callback
  • admin-head-callback
  • admin-preview-callback
Share Improve this question asked Jun 19, 2014 at 10:48 henrywrighthenrywright 3,1076 gold badges39 silver badges65 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Those are name of callback function which would be enabled for custom header.

For example: if custom_function is assigned to 'wp-head-callback' then, there would be an action call like:

add_action('wp_head','custom_function')

custom_function is the function you need to define.

发布评论

评论列表(0)

  1. 暂无评论