wordpress在functions.php中使用模板标记时忽略格式设置
我正在使用以下代码创建一个在所见即所得中使用的短代码wordpress在functions.php中使用模板标记时忽略格式设置,php,wordpress,function,Php,Wordpress,Function,我正在使用以下代码创建一个在所见即所得中使用的短代码 function consultants( $atts, $content = null ) { $output = ''; $consultant_query = new WP_Query('post_type=consultants&showposts=10'); if ($consultant_query->have_posts()) : $output .= '<div class="col-md-12">
function consultants( $atts, $content = null ) {
$output = '';
$consultant_query = new WP_Query('post_type=consultants&showposts=10');
if ($consultant_query->have_posts()) :
$output .= '<div class="col-md-12">';
while ($consultant_query->have_posts()) : $consultant_query->the_post();
$output .= '<div class="col-xs-12 col-sm-5 col-md-4 kam-tile-own-bg"><h1>' .the_title(). '</h1> ';
if(has_post_thumbnail())
{
$output .= get_the_post_thumbnail($post->ID,'wpbs-featured-avatar');
} else {
$output .= '
<img class="kam-avatar" width="62" height="62" src="'.get_template_directory_uri().'/images/avatar@2x.jpg" class="attachment-featured_image wp-post-image" alt="" />'; }
$output .= '</div>';
endwhile;
$output .= '</div>';
endif;
wp_reset_postdata();
return $output;
}
功能顾问($atts,$content=null){
$output='';
$consultant_query=new WP_query('post_type=consultants&showposts=10');
如果($consultant\u query->have\u posts()):
$output.='';
而($consultant_query->have_posts()):$consultant_query->the_post();
$output.=''.the_title()';
如果(具有\u post\u缩略图())
{
$output.=获取帖子缩略图($post->ID,'wpbs-featured-avatar');
}否则{
$output.='
'; }
$output.='';
结束时;
$output.='';
endif;
wp_reset_postdata();
返回$output;
}
代码工作正常-但是它在上失败。_title()
非常感谢而不是标题()代码>使用获取标题()代码>最好在这里发布。。。如何阻止php从以下php中的URL中剥离/
<代码>$output.='