我试图完成这项工作,但它无法正常工作。这段代码有什么问题?
add_filter( 'the_content', 'addslider_hook' );
function addslider_hook ( $content ) {
if ( is_page('outsourced') ) {
$slide = '[rev_slider outsourced]';
$hook_slide = do_shortcode( $slide );
$content .= "<div class='page-slider'>";
$content .= $hook_slide;
$content .= "</div>";
}
return $content;
}
答案 0 :(得分:0)
你在代码的底部有一个额外的}。你可以试试这个
if ( is_page('outsourced') ) {
$content .= "<div class='page-slider'>";
$content .= do_shortcode('[rev_slider outsourced]');
$content .= "</div>";
echo $content;
}