WordPress函数the_content()和get_the_content()用法详解 (输出/打印文章内容函数)
文 / @WordPress主题
WordPress的the_content()函数
the_content() 函数是 WordPress 中的一个核心函数,用于显示文章的内容。它可以用在 WordPress 的模板文件中,具体用法如下:
the_content(string $more_link_text = null, bool $strip_teaser = false);
使用这个函数后,WordPress 会自动显示文章的内容,包括文字、图片和其他媒体。此外,它还可以添加分页符,如果文章过长,可以分成多个页面显示。
请注意,这个函数只能用于显示文章内容,如果要显示其他类型的内容,比如页面或自定义文章类型,需要使用其他函数,比如 the_page_content() 或 the_content_for_custom_post_type()。
注:the_content()函数位于:wp-includes/post-template.php
WordPress的get_the_content()函数
get_the_content() 函数是 WordPress 中的一个核心函数,用于显示文章的内容。它可以用在 WordPress 的模板文件中,具体用法如下:
get_the_content(string $more_link_text = null, bool $strip_teaser = false); 使用这个函数后,WordPress 会自动显示文章的内容,包括文字、图片和其他媒体。此外,它还可以添加分页符,如果文章过长,可以分成多个页面显示。
注:the_content()函数位于:wp-includes/post-template.php
the_content()和get_the_content()两个函数的关系
//the_content() = echo get_the_content()
;

相关文章
-
搭建一个WordPress网站需要多少成本 2023-11-06 00:09:51
-
Symlink介绍(附:如何使用Symlink进行WordPress开发) 2023-11-05 23:38:32
-
让WordPress实现数据库同步的插件:HyperDB 2023-10-24 23:40:49
-
allegro电商平台值得做吗(附:2023年Allegro注册流程指南) 2023-10-08 21:53:39
-
印度跨境电商平台有哪些(附:印度跨境电商做什么产品好) 2023-10-08 21:34:23
-
跨境电商必看的几大海外二手电商平台 2023-10-08 18:04:42
-
WordPress同城互联网产品解决方案:UBASE 2023-10-03 16:40:39
-
WordPress网站的安全插件:wordfence 2023-09-14 09:25:18
-
WordPress 6.3 支持在手动更新插件和主题失败后回滚旧版本 2023-08-28 16:58:45
-
WordPress 6.3版本(2023年8月)性能提升了哪些? 2023-08-28 16:56:02