wordpress   发布时间:2022-05-06  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了在所有WordPress文章底部添加自定义内容大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

WordPress网站建设的过程中,有时候站长朋友们需要在所有文章底部添加自定义内容,比如注明文章是本站原创的,提醒别人在转载的时候请注明出处。今天我们就向大家介绍一下实现的具体方法

切换到主题目录,打开 functions.PHP 文件,加入以下代码即可:

Crayon-5c891cc153a11483430762" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">functions.PHP
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-language">PHP
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891cc153a11483430762-1">1
Crayon-num Crayon-striped-num" data-line="Crayon-5c891cc153a11483430762-2">2
Crayon-num" data-line="Crayon-5c891cc153a11483430762-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891cc153a11483430762-4">4
Crayon-num" data-line="Crayon-5c891cc153a11483430762-5">5
Crayon-num Crayon-striped-num" data-line="Crayon-5c891cc153a11483430762-6">6
Crayon-num" data-line="Crayon-5c891cc153a11483430762-7">7
Crayon-num Crayon-striped-num" data-line="Crayon-5c891cc153a11483430762-8">8
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891cc153a11483430762-1">Crayon-c">//在所有文章底部添加自定义内容
Crayon-line Crayon-striped-line" id="Crayon-5c891cc153a11483430762-2">Crayon-t">functionCrayon-h"> Crayon-e">add_after_post_contentCrayon-sy">(Crayon-v">$contentCrayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line" id="Crayon-5c891cc153a11483430762-3">Crayon-h"> Crayon-st">ifCrayon-sy">(Crayon-o">!Crayon-e">is_FeedCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-o">&&Crayon-h"> Crayon-o">!Crayon-e">is_homeCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-o">&&Crayon-h"> Crayon-e">is_singularCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-o">&&Crayon-h"> Crayon-e">is_main_queryCrayon-sy">(Crayon-sy">)Crayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line Crayon-striped-line" id="Crayon-5c891cc153a11483430762-4">Crayon-h"> Crayon-v">$contentCrayon-h"> Crayon-sy">.Crayon-o">=Crayon-h"> Crayon-s">'如无特殊说明,文章均为本站原创,转载请注明出处'Crayon-sy">;
Crayon-line" id="Crayon-5c891cc153a11483430762-5">Crayon-h"> Crayon-sy">}
Crayon-line Crayon-striped-line" id="Crayon-5c891cc153a11483430762-6">Crayon-h"> Crayon-k ">returnCrayon-h"> Crayon-v">$contentCrayon-sy">;
Crayon-line" id="Crayon-5c891cc153a11483430762-7">Crayon-sy">}
Crayon-line Crayon-striped-line" id="Crayon-5c891cc153a11483430762-8">Crayon-e">add_filterCrayon-sy">(Crayon-s">'the_content'Crayon-sy">,Crayon-h"> Crayon-s">'add_after_post_content'Crayon-sy">)Crayon-sy">;

第 3 行代码使用了条件判断标签禁止Feed首页输出自定义内容

大佬总结

以上是大佬教程为你收集整理的在所有WordPress文章底部添加自定义内容全部内容,希望文章能够帮你解决在所有WordPress文章底部添加自定义内容所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: