在标题图像面板中,有一个说明,说明:
单击“添加新图像”从计算机上载图像文件。标题大小为1200×280像素的图像最适合你的主题,上传后,你可以裁剪出完美的图片
我试图用以下内容更改此文本:
$wp_customize->get_control( \'header_image\' )->description = \'New text here\';
但它不起作用。我错过什么了吗?在标题图像面板中,有一个说明,说明:
单击“添加新图像”从计算机上载图像文件。标题大小为1200×280像素的图像最适合你的主题,上传后,你可以裁剪出完美的图片
我试图用以下内容更改此文本:
$wp_customize->get_control( \'header_image\' )->description = \'New text here\';
但它不起作用。我错过什么了吗?这个description
很遗憾,此控件中未使用param。您可以看到消息是hard-coded in the control\'s template. 这应该在core中更改,但同时,您可以在customize_controls_enqueue_scripts
依赖于的操作customize-controls
这样做:
wp.customize.control( \'header_image\', function( control ) {
control.deferred.embedded.done( function() {
var el = control.container.find( \'.customize-control-description\' );
el.html( control.params.description );
} );
} );
如果控件description
param在将来的版本中开始在core中使用。function change_header_image_desc( $translated_text ) {
if ( $translated_text == \'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header size of %s pixels.\' ) {
$translated_text = \'New Description here\';
}
return $translated_text;
}
add_filter( \'gettext\', \'change_header_image_desc\', 20 );
这是区分大小写的,所以请按您在WordPress主题上看到的内容键入。我试图了解动作挂钩和过滤器是如何工作的,我想编辑这个示例此函数位于父主题框架php文件中:public function formatArticleCat01( $show_category = false, $shorten_text_chars = 300, $show_date = true, $show_comments = false, $show_author = false, $show_views = false ) { $sFigure = ( $this->article