在WordPress页面中插入PHP代码并发布

在WordPress页面中插入PHP代码并发布,第1张

在WordPress页面中插入PHP代码并发布

WordPress默认情况下不会在帖子/页面内容中执行PHP,除非它具有简码

最快,最简单的方法是使用一个插件,使您可以运行嵌入在帖子内容中的PHP。

在没有插件的情况下,还有另外两种“快速简便”的方法可以完成此任务:

  • 将其设置为简码 (输入

    functions.php
    并使其与国家/地区名称相呼应)非常简单-参见此处:WP Codex的简码API

  • Put it in a template file - make a custom template for that page based on your default page template and add the PHP into the template file rather than the post content: Custom Page Templates



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4917446.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-12
下一篇 2022-11-12

发表评论

登录后才能评论

评论列表(0条)

保存