0

尽管我被困在其中,但这可能看起来是一个普通的问题。我是wordpress的新手。我已经购买了一个 wordpress 主题,并且正在尝试根据需要编辑一些页面。现在我想编辑我已经开始编辑“single.php”和“post-format.php”文件的默认帖子页面。我想知道“the_content()”函数从哪里或如何获取数据?

由于我希望删除页面的某些 html 部分,尽管该 html 部分来自“the_content”函数。因此,我无法在不摆脱“the_content”功能的情况下删除该部分。但是我无法摆脱“the_content”函数,因为同样的函数也调用了一些重要的部分。

希望大家能帮忙!

4

1 回答 1

0

从哪里

  1. 作为一个函数get_the_content(),从数据库中检索帖子内容(通常在循环中使用)并在前端打印。
  2. 再次the_content()作为过滤器控制您如何显示帖子内容。

如何

WordPress API 的简单回答。您需要了解 WordPress Database_API才能深入了解。

经常使用

wp-includes/plugin.php: apply_filters()
wp-includes/post-template.php: get_the_content()
wp-includes/post-template.php: the_content

用例:(来自Codex

  • post_password_required()
  • get_the_password_form() 如果 post_password_required() 失败
  • wp_kses_no_null() 处理标签时。
  • 平衡标签()
  • get_permalink()
  • 全局:$id、$post、$more、$page、$pagesm、$multipage、$preview、$pagenow

参考: -过滤器the_content() | 功能the_content()

可选:适用于Windows / OSx的离线 WP Codex 文档搜索/浏览器

于 2016-04-12T13:24:21.923 回答