如何从侧边栏获取特定的小部件(我想要Google评论小部件)?

我正在尝试使用以下代码在页面中获取特定的审阅小部件, 但它不起作用<?php if(!dynamic_sidebar(‘Google Review Widget’)):?>

当我不带任何参数传递它时, 它会在边栏中显示所有小部件<?php if(!dynamic_sidebar(‘Google Review Widget’)):?>


#1


你的代码说”如果不存在称为’Google Review Widget’的侧边栏, 则…”, 没有其他任何内容。你实际上并没有试图显示侧边栏, 只是检查它是否存在, 如果不存在, 则回退到…什么都没有。

只需使用:<?php dynamic_sidebar(‘Google Review Widget’); ?>显示它。


#2


标准WP功能不支持从侧边栏中仅显示单个窗口小部件。只需在funtions.php中注册一个新的侧边栏-参见此处的操作方法:https://codex.wordpress.org/Function_Reference/register_sidebar

来源:

https://www.srcmini02.com/63078.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37689.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?