Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.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
Html 短码返回跳转到wordpress中的div之外_Html_Wordpress_Shortcode - Fatal编程技术网

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()是未定义的函数。