gpt4 book ai didi

页脚中的 WordPress 短代码不起作用

转载 作者:行者123 更新时间:2023-12-02 23:42:34 27 4
gpt4 key购买 nike

我想为我的联系表单显示一个插件。问题是我想将它放在页脚中。所以我采用了简码

[Contact_Form_Builder id="1"]

并通过粘贴它

<?php echo do_shortcode( '[Contact_Form_Builder id="1"]' ); ?>    

在页脚中,但它仍然只显示文本。你知道我该如何解决这个问题吗?这是示例: http://codefragment.eu/high/

最佳答案

  1. 将以下代码添加到您的 functions.php 文件

    add_filter('widget_text', 'shortcode_unautop');
    add_filter('widget_text', 'do_shortcode');

    The second line is the one that makes the shortcodes work, but you’ll want to include both. If you check “add paragraphs automatically” on the widget, WordPress will apply the autop filter — the one that turns your line breaks into paragraph and break tags. If a shortcode is on its own line, it would normally get wrapped in a paragraph tag. The first line prevents that from happening.

    Source

  2. 然后使用文本小部件将您的短代码(就像您的第一个代码块一样)放置在页脚中

一个similar plugin也可用。

关于页脚中的 WordPress 短代码不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27277610/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com