Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
wordpress在functions.php中使用模板标记时忽略格式设置_Php_Wordpress_Function - Fatal编程技术网

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.='