Html 短码返回跳转到wordpress中的div之外
问题是,Html 短码返回跳转到wordpress中的div之外,html,wordpress,shortcode,Html,Wordpress,Shortcode,问题是,ratigs()跳出了 函数wpratings($atts,$content=null){ 返回“Rating:”。返回“U ratings()”; } 添加快捷代码(“wpratings”、“wpratings”); 短代码输出示例: 5.00 <<< this is output of the_ratings() Here is the post content Rating: <<< this is place of <div id="w
ratigs()
跳出了
函数wpratings($atts,$content=null){
返回“Rating:”。返回“U ratings()”;
}
添加快捷代码(“wpratings”、“wpratings”);
短代码输出示例:
5.00 <<< this is output of the_ratings()
Here is the post content
Rating: <<< this is place of <div id="wpratings">
5.00这有什么区别吗
function wpratings( $atts, $content = null ) {
$content = the_ratings();
return '<div id="wpratings"><b>Rating: </b>' . $content . '</div>';
}
add_shortcode("wpratings", "wpratings");
函数wpratings($atts,$content=null){
$content=_评级();
返回“评级:”.$content.”;
}
添加快捷代码(“wpratings”、“wpratings”);
$content
是放置在[shortcode]content[/shortcode]
标记之间的内容。这有什么区别吗
function wpratings( $atts, $content = null ) {
$content = the_ratings();
return '<div id="wpratings"><b>Rating: </b>' . $content . '</div>';
}
add_shortcode("wpratings", "wpratings");
函数wpratings($atts,$content=null){
$content=_评级();
返回“评级:”.$content.”;
}
添加快捷代码(“wpratings”、“wpratings”);
$content
是放置在[shortcode]内容[/shortcode]
标记之间的内容。通常,任何以开头的函数都将打印结果。您需要的是一个等效函数获取评分()
在WP中,我们有标题
和获取标题
,内容
和获取内容
。这就是它失败的原因,短代码必须返回值,而不是打印值
你没有提到这是什么插件。如果是,则没有获得评级,但您有以下条件:
the_ratings($start_tag = 'div', $custom_id = 0, $display = true)
解决方案:将$display
传递为false
return '<div id="wpratings"><b>Rating: </b>' . the_ratings('div',0,false) . '</div>';
返回“评级:”。_评级(“div”,0,false)。”;
通常,任何以*
开头的函数都将打印结果。您需要的是一个等效函数获取评分()
在WP中,我们有标题
和获取标题
,内容
和获取内容
。这就是它失败的原因,短代码必须返回值,而不是打印值
你没有提到这是什么插件。如果是,则没有获得评级,但您有以下条件:
the_ratings($start_tag = 'div', $custom_id = 0, $display = true)
解决方案:将$display
传递为false
return '<div id="wpratings"><b>Rating: </b>' . the_ratings('div',0,false) . '</div>';
返回“评级:”。_评级(“div”,0,false)。”;
我理解。get__ratings()是未定义的函数。我理解它。get__ratings()是未定义的函数。