添加其他默认标题到WordPress二十十主题
Twenty Ten主题附带八个默认标题。您设置的任何默认标题都将替换为帖子的“特色图片”。您只能在查看该帖子时看到新标题。在本周的WordPress快速提示中,我们将看到向标题面板添加额外标题是多么简单。
观看截屏视频
<embed src="https://down.d1sc.cn/wordpress/2022/08/06/tt5wazaqhsp.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/berries-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Berries’, ‘twentyten’ ) ), ‘cherryblossom’ => array( ‘url’ => ‘%s/images/headers/cherryblossoms.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/cherryblossoms-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Cherry Blossoms’, ‘twentyten’ ) ), ‘concave’ => array( ‘url’ => ‘%s/images/headers/concave.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/concave-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Concave’, ‘twentyten’ ) ), ‘fern’ => array( ‘url’ => ‘%s/images/headers/fern.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/fern-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Fern’, ‘twentyten’ ) ), ‘forestfloor’ => array( ‘url’ => ‘%s/images/headers/forestfloor.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/forestfloor-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Forest Floor’, ‘twentyten’ ) ), ‘inkwell’ => array( ‘url’ => ‘%s/images/headers/inkwell.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/inkwell-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Inkwell’, ‘twentyten’ ) ), ‘path’ => array( ‘url’ => ‘%s/images/headers/path.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/path-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Path’, ‘twentyten’ ) ), ‘sunset’ => array( ‘url’ => ‘%s/images/headers/sunset.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/sunset-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Sunset’, ‘twentyten’ ) ), ‘waterfall’ => array( ‘url’ => ‘%s/images/headers/waterfall.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/waterfall-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Waterfall’, ‘twentyten’ ) ), ‘mountain’ => array( ‘url’ => ‘%s/images/headers/mountain.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/mountain-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Mountain’, ‘twentyten’ ) ) ) );
让我们稍微剖析一下代码。
register_default_headers:这是创建并显示默认值的函数头。它接受一个参数数组。
name:使用我们的标题名称设置一个值。然后我们可以设置一个附加值和键的数组。
url:标题图像的相对路径。请注意,当前路径为/images/headers/image_name.jpg
thumbnail_url:标题图像缩略图的相对路径。当前路径为/images/headers/image_name-thumbnail.jpg
description:图像说明。将鼠标悬停在Headers Panel内的图像上时显示。
要注意的事项
Twenty Ten主题附带八个默认标题。您设置的任何默认标题都将替换为帖子的“特色图片”。您只能在查看该帖子时看到新标题。在本周的WordPress快速提示中,我们将看到向标题面板添加额外标题是多么简单。
观看截屏视频
<embed src="https://down.d1sc.cn/wordpress/2022/08/06/tt5wazaqhsp.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/berries-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Berries’, ‘twentyten’ ) ), ‘cherryblossom’ => array( ‘url’ => ‘%s/images/headers/cherryblossoms.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/cherryblossoms-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Cherry Blossoms’, ‘twentyten’ ) ), ‘concave’ => array( ‘url’ => ‘%s/images/headers/concave.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/concave-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Concave’, ‘twentyten’ ) ), ‘fern’ => array( ‘url’ => ‘%s/images/headers/fern.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/fern-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Fern’, ‘twentyten’ ) ), ‘forestfloor’ => array( ‘url’ => ‘%s/images/headers/forestfloor.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/forestfloor-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Forest Floor’, ‘twentyten’ ) ), ‘inkwell’ => array( ‘url’ => ‘%s/images/headers/inkwell.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/inkwell-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Inkwell’, ‘twentyten’ ) ), ‘path’ => array( ‘url’ => ‘%s/images/headers/path.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/path-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Path’, ‘twentyten’ ) ), ‘sunset’ => array( ‘url’ => ‘%s/images/headers/sunset.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/sunset-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Sunset’, ‘twentyten’ ) ), ‘waterfall’ => array( ‘url’ => ‘%s/images/headers/waterfall.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/waterfall-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Waterfall’, ‘twentyten’ ) ), ‘mountain’ => array( ‘url’ => ‘%s/images/headers/mountain.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/mountain-thumbnail.jpg’, /* translators: header image description */ ‘description’ => __( ‘Mountain’, ‘twentyten’ ) ) ) );
让我们稍微剖析一下代码。
register_default_headers:这是创建并显示默认值的函数头。它接受一个参数数组。
name:使用我们的标题名称设置一个值。然后我们可以设置一个附加值和键的数组。
url:标题图像的相对路径。请注意,当前路径为/images/headers/image_name.jpg
thumbnail_url:标题图像缩略图的相对路径。当前路径为/images/headers/image_name-thumbnail.jpg
description:图像说明。将鼠标悬停在Headers Panel内的图像上时显示。