
在看 twenty-fourteen 這個官網主題時,會發現主題有 背景和頭部設定。
這個是怎麼出來的呢?
其實是用到了 add_theme_support 這個函式。
add_theme_support( 'custom-background', apply_filters( 'twentyfourteen_custom_background_args', array(
'default-color' => 'f5f5f5',
) ) );
require get_template_directory() . '/inc/custom-header.php';
-----------
比如縮圖,也是由這個函式在 function.php 裡設定的。
程式碼:
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 672, 372, true );
add_image_size( 'twentyfourteen-full-width', 1038, 576, true );
-------------
還有文章格式,也是由它設定的:
程式碼:
add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery',
) );
--------------------
http://codex.WordPress.org/Function_Reference/add_theme_support