简体   繁体   中英

Nested Shortcodes?

For my WordPress site, I am using both PODS, and WPDataTables to manage my data. 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. This is more or less what I would like to achieve (var1 = the output of another shortcode) :

[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:

[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. 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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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