将一些元素称为WP主题

时间:2015-03-11 10:39:40

标签: php wordpress function themes

我在wp主题中添加了一些功能,但我不知道如何使它们工作! :)

这是我的functions.php代码:

<?php
if ( ! function_exists('theme_features') ) {

// Register Theme Features
function theme_features()  {

    // Add theme support for Automatic Feed Links
    add_theme_support( 'automatic-feed-links' );

    // Add theme support for Post Formats
    add_theme_support( 'post-formats', array( 'status', 'quote', 'gallery', 'image', 'video', 'audio', 'link', 'aside', 'chat' ) );

    // Add theme support for Featured Images
    add_theme_support( 'post-thumbnails' );

     // Set custom thumbnail dimensions
    set_post_thumbnail_size( 250, 300, true );

    // Add theme support for Custom Background
    $background_args = array(
        'default-color'          => 'ffffff',
        'default-image'          => '',
        'default-repeat'         => '',
        'default-position-x'     => '',
        'wp-head-callback'       => '',
        'admin-head-callback'    => '',
        'admin-preview-callback' => '',
    );
    add_theme_support( 'custom-background', $background_args );

    // Add theme support for Custom Header
    $header_args = array(
        'default-image'          => '',
        'width'                  => 0,
        'height'                 => 0,
        'flex-width'             => false,
        'flex-height'            => false,
        'uploads'                => true,
        'random-default'         => false,
        'header-text'            => false,
        'default-text-color'     => '',
        'wp-head-callback'       => '',
        'admin-head-callback'    => '',
        'admin-preview-callback' => '',
    );
    add_theme_support( 'custom-header', $header_args );

    // Add theme support for HTML5 Semantic Markup
    add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );

    // Add theme support for document Title tag
    add_theme_support( 'title-tag' );

    // Add theme support for Translation
    load_theme_textdomain( '2015_movie_tr', get_template_directory() . '/language' );
}

// Hook into the 'after_setup_theme' action
add_action( 'after_setup_theme', 'theme_features' );

}
?>

我需要得到的项目是:

  1. 添加背景颜色
  2. 添加标题图片(现在我有标题图片,但我使用css背景)。
  3. 背景图片
  4. 我应该在我的主题中为这些元素添加哪些代码才能获得作品以及在哪些部分?

    因为我将这些代码添加到我的functions.php我收到了这个错误:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '' not found or invalid function name in C:\Program Files (x86)\Ampps\www\tester\wp-includes\plugin.php on line 496
    

    谢谢。

0 个答案:

没有答案