【发布时间】:2014-05-19 22:44:00
【问题描述】:
我正在使用来自名为 Divi
的优雅主题的 wordpress 主题它们有一个全宽滑块,顶部有一个按钮。当您将文本输入到填充按钮的表单字段中时,您可以输入 html,但是当它在页面上呈现时,您可以看到 html 而不是看到输出。
我查看了functions.php 并找到了我放在下面的按钮的代码块。我认为这与esc_html 标签有关,但对此没有太多经验?
add_shortcode( 'et_pb_slide', 'et_pb_slide' );
function et_pb_slide( $atts, $content = '' ) {
extract( shortcode_atts( array(
'alignment' => 'center',
'heading' => '',
'button_text' => '',
'button_link' => '#',
'background_color' => '',
'background_image' => '',
'image' => '',
'image_alt' => '',
'background_layout' => 'dark',
'video_bg_webm' => '',
'video_bg_mp4' => '',
'video_bg_width' => '',
'video_bg_height' => '',
'video_url' => '',
), $atts
) );
这是按钮的直接代码。
$button = '';
if ( '' !== $button_text )
$button = sprintf( '<a href="%1$s" class="et_pb_more_button">%2$s</a>',
esc_attr( $button_link ),
esc_html( $button_text )
);
抱歉,目前无法提供网址。
【问题讨论】: