简体   繁体   English

嵌套简码?

[英]Nested Shortcodes?

For my WordPress site, I am using both PODS, and WPDataTables to manage my data.对于我的 WordPress 站点,我同时使用 PODS 和 WPDataTables 来管理我的数据。 With that, I am using WPDT's "placeholder" feature to create dynamic SQL queries that will display different data depending on what user is logged in. Currently, I can ALMOST do everything I need, but not quite.有了这个,我正在使用 WPDT 的“占位符”功能来创建动态 SQL 查询,这些查询将根据登录的用户显示不同的数据。目前,我几乎可以做我需要的一切,但还不够。 This is more or less what I would like to achieve (var1 = the output of another shortcode) :这或多或少是我想要实现的(var1 = 另一个短代码的输出)

[wpdatatable id=14 var1= 
[pods name="User" template="Company" where="id = {@user.id}"][/pod]]
[/wpdatatable]

This shortcode is working, and will pull back a single number, based on the user that is logged in:此短代码正在运行,并将根据登录的用户拉回一个数字:

Company: [pods name="User" template="Company" where="id = {@user.id}"]

And this code is working if I hardcode a specific value to var1:如果我将特定值硬编码到 var1,则此代码有效:

[wpdatatable id=14 var1=5]

Basically, I have two separate shortcodes that work individually, but will not work when put together.基本上,我有两个单独的短代码可以单独工作,但放在一起时将不起作用。 I was wondering if something like this would be possible?我想知道这样的事情是否可能? Or if I needed to maybe think of a new approach.或者,如果我需要考虑一种新方法。 Thanks in advance!提前致谢!

Side Note: I have tried using the " Outerbridge Nested Shortcodes " plug-in without any luck.旁注:我尝试使用“ Outerbridge Nested Shortcodes ”插件但没有任何运气。 After talking with the plug-in author, I discovered that this plugin only works for:和插件作者交流后,发现这个插件只适用于:

[tag-a] [tag-b] [/tag-a]

And not:并不是:

[tag-a [tag-b] ]

这是 wpdatatable 需要启用的东西,就像我们为 pod 做的那样,但那将是另一种方式,看看它是如何为 pod 完成的: https : //pods.io/docs/build/using-shortcodes-pods-templates/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM