Skip Navigation

[Resolved] Shortcode as attribute of a view

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 0.30 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 8 months ago.

Assisted by: Minesh.

Author
Posts
#2687470

Hi, I've the CPT comidas-del-dia with the custom field "fecha" (it's a date field).
I built a legacy view with the query filter by attribute "fechadia" to display only a certain comidas-del-dia entry.
I've added a test entry with field "fecha" value 1710115200 (unix timestamp).

I made few tests on this page:

hidden link

1. If I pass the attribute fechadia=1710115200 I correctly get the entry.

[wpv-view name="comida-del-dia-dia" fechadia="1710115200"]

2. If I pass the attribute fechadia=888888888 I correctly get no result.

[wpv-view name="comida-del-dia-dia" fechadia="888888888"]

I've created the custom shortcode [fecha-dia] that return the timestamp of a certain day of the current week based on the attribute diasemana where I pass 1,2,3,...7:

[fecha-dia diasemana='1' semana='current' format='U']

3 - 4. It works fine, this week the result of this short code is 1710115200.

5 - 6. If I use the shortcode to pass the value to the view in this way:

[wpv-view name="comida-del-dia-dia" fechadia="[fecha-dia diasemana='1' semana='current' format='U']"]

it doesn't work, it breaks the view.

I've avoided any problem with quotation marks with this hook:

remove_filter('the_content', 'wptexturize');

How can I fix it?

thanks
cheers

#2687547

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

When you pass the custom shortcode as view's shortcode argument, you will have to register the custom shortcode at:
=> Toolset => Settings => Fornt-end Content tab => Argumentos de shortcode de terceros

As you can see I've register the shortcode name fecha-dia at section "Argumentos de shortcode de terceros":
=> hidden link

More info:
- https://toolset.com/documentation/legacy-features/views-plugin/shortcodes-within-shortcodes/#third-party-shortcode-arguments

Can you please confirm it works as expected now.

#2687593

Hey, thank you!!!