使用 Timber 插件时不呈现 wordpress 简单短代码 [英] wordpress simple shortcodes not rendered when using Timber plugin

查看:30
本文介绍了使用 Timber 插件时不呈现 wordpress 简单短代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近使用 Timber(我不熟悉)接管了 Wordpress 网站的开发.我正在尝试使用新插件和随附的短代码,这当然不起作用.

I've recently taken over dev of a Wordpress site using Timber (which I wasn't familiar with). I'm attempting to use a new plugin and accompanying shortcode, which of course doesn't work.

我已经研究了几个小时,似乎没有一个简单的答案.为了使用这样的简单短代码:

I've been researching this for a couple hours and there doesn't seem to be a simple answer. In order to use a simple shortcode like this:

[sp_faq category="7"]

[sp_faq category="7"]

我真的需要在functions.php中创建一个自定义的短代码函数,为它添加某种模板文件等吗?这似乎违反了 Twig 使事情变得简单"的直觉.

Do I really need to create a custom shortcode function in functions.php, add some sort of template file for it, etc? This seems counterintuitive to Twig's making things 'simple'.

除非我遗漏了一些明显的东西,否则这方面的文档并不出色.

The documentation for this is less than stellar unless I'm missing something obvious.

推荐答案

你可以试试这个(使用重力表单简码的例子):

You could try this (example using a gravity form shortcode):

{% filter shortcodes %}
  [gravityforms id="1"]
{% endfilter %}

这篇关于使用 Timber 插件时不呈现 wordpress 简单短代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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