admin管理员组文章数量:1130349
the page automatically display a number inside a div called wpb_wrapper, when I use a custom shortcode. but its nowhere in my function. When I delete the shortcode the number goes away.
<div class="wpb_text_column wpb_content_element " >
<div class="wpb_wrapper">
1
</div>
</div>
Any clues?
Is a custom Shortcode to display a grid of post, it contains PHP code, HTML tags and CSS.
function millennium_grid(){
return include("mg-custom-grid.php");
add_shortcode('millennium', 'millennium_grid');
the page automatically display a number inside a div called wpb_wrapper, when I use a custom shortcode. but its nowhere in my function. When I delete the shortcode the number goes away.
<div class="wpb_text_column wpb_content_element " >
<div class="wpb_wrapper">
1
</div>
</div>
Any clues?
Is a custom Shortcode to display a grid of post, it contains PHP code, HTML tags and CSS.
function millennium_grid(){
return include("mg-custom-grid.php");
add_shortcode('millennium', 'millennium_grid');
Share
Improve this question
edited Nov 21, 2018 at 15:28
Trauko
asked Nov 21, 2018 at 15:17
TraukoTrauko
251 silver badge6 bronze badges
1
- 1 Which shortcode / plugin you are referring to? Can you be more specific? – middlelady Commented Nov 21, 2018 at 15:23
1 Answer
Reset to default 1You can't return an include like that. A successful include() itself returns 1, and since you're returning the return value of include, your shortcode is displaying "1".
Handling Returns: include returns FALSE on failure and raises a warning. Successful includes, unless overridden by the included file, return 1.
— http://php/manual/en/function.include.php
If you want to output a template or similar file from shortcode, you need to capture it with output buffering:
function millennium_grid() {
ob_start();
include 'mg-custom-grid.php';
return ob_get_clean();
}
add_shortcode( 'millennium', 'millennium_grid' );
the page automatically display a number inside a div called wpb_wrapper, when I use a custom shortcode. but its nowhere in my function. When I delete the shortcode the number goes away.
<div class="wpb_text_column wpb_content_element " >
<div class="wpb_wrapper">
1
</div>
</div>
Any clues?
Is a custom Shortcode to display a grid of post, it contains PHP code, HTML tags and CSS.
function millennium_grid(){
return include("mg-custom-grid.php");
add_shortcode('millennium', 'millennium_grid');
the page automatically display a number inside a div called wpb_wrapper, when I use a custom shortcode. but its nowhere in my function. When I delete the shortcode the number goes away.
<div class="wpb_text_column wpb_content_element " >
<div class="wpb_wrapper">
1
</div>
</div>
Any clues?
Is a custom Shortcode to display a grid of post, it contains PHP code, HTML tags and CSS.
function millennium_grid(){
return include("mg-custom-grid.php");
add_shortcode('millennium', 'millennium_grid');
Share
Improve this question
edited Nov 21, 2018 at 15:28
Trauko
asked Nov 21, 2018 at 15:17
TraukoTrauko
251 silver badge6 bronze badges
1
- 1 Which shortcode / plugin you are referring to? Can you be more specific? – middlelady Commented Nov 21, 2018 at 15:23
1 Answer
Reset to default 1You can't return an include like that. A successful include() itself returns 1, and since you're returning the return value of include, your shortcode is displaying "1".
Handling Returns: include returns FALSE on failure and raises a warning. Successful includes, unless overridden by the included file, return 1.
— http://php/manual/en/function.include.php
If you want to output a template or similar file from shortcode, you need to capture it with output buffering:
function millennium_grid() {
ob_start();
include 'mg-custom-grid.php';
return ob_get_clean();
}
add_shortcode( 'millennium', 'millennium_grid' );
本文标签: A number appears inside a div called wpbwrapperwhen I use a custom shortcode
版权声明:本文标题:A number appears inside a div called wpb_wrapper, when I use a custom shortcode 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749162449a2325622.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论