wordpress中的”do_shortcode”是什么以及它如何工作?

我目前正在学习wordpress主题开发, 为了更好地理解, 我下载了几个wordpress主题并查看其代码。但是我看不懂一行代码。这是->

<?php echo do_shortcode(sq_option( 'footer_text ' ' ')); ?>

也许它适合页脚, 但是它是如何工作的, 以及当我创建自己的方法时如何使用此功能。


#1


如果要在自定义主题模板页面中执行简码, do_shortcode是必须使用的函数, 有关此函数的更多信息, 请参见:https://developer.wordpress.org/reference/functions/do_shortcode/


#2


通常是do_shortcode();用于从shortcode或其属性到PHP代码中获取数据, 或过滤返回的shortcode数据。短代码可以由任何插件提供。

不确定, 但是在你主题的代码中sq_option(” footer_text”);可能是从页脚中过滤掉一些文本的功能。

代码可以是:

<?php echo do_shortcode(‘[contact-form-7 id =” 91″ title =” quote”]’); ?>

参考链接

来源:

https://www.srcmini02.com/67533.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_36867.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?