如何在“the_content()"前后添加代码在 wordpress 中 [英] How to add a code before and after "the_content()" in wordpress

查看:24
本文介绍了如何在“the_content()"前后添加代码在 wordpress 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的输出是这样的 -

i want my output to be like this -

echo 'codeBefore';
the_content();
echo 'codeAfter';

问题是,我使用的插件之一在内容前后插入其代码&我得到的输出是这样的.

Problem is, one of the plugin i use inserts its code before and after the content & output i get is something like this.

  echo 'codeBefore';
  <plugin code>
  the_content();
  <plugin code>
  echo 'codeAfter';

如何让我的代码显示在任何其他插件代码之前?

How to get my code displayed in front before any other plugin codes ?

推荐答案

代码下方的用户

 function slideshow_fun( $content ) {
        if ( is_single() ) {
            $custom_content = '[plugin_shortcode]';
            $custom_content .= $content;
            return $custom_content;
        } else {
            return $content;
        }
    }
    add_filter( 'the_content', 'slideshow_fun' );

更多细节和信用

这篇关于如何在“the_content()"前后添加代码在 wordpress 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆