Skip Navigation

[Resolved] wpv attribute nested shortcode

This support ticket is created 5 years ago. There's a good chance that you are reading advice that it now obsolete.

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.

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

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Shane 5 years ago.

Assisted by: Shane.

Author
Posts
#1371459

I have a custom shortcode. This is registered with views. I attempting to put a [post-title] shortcode inside of my shortcode and it doesn't work.

Let me explain: my shortcode works with a nested title shortcode when used on a page, as follows...

[myShortcode catagory="[post-cat]" type="id"]

The results are as expected, getting the category of the page we're on. This outputs something like 34,18,105,77.

When I use this in a wpv shortcode it does not work. Here is that shortcode:

[wpv-view name="myViewName" terms="[myShortcode category="[post-cat]" type="id"]"]

I am using terms as my filter in the view. But since the shortcode isn't outputting the IDs as in the first example, this isn't working and the filter isn't getting the correct results.

Any thoughts here?

Thanks for your assistance.

#1371471

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robina,

Thank you for getting in touch.

You say your custom shortcode isn't outputting the id of the categories?

I'm not sure what your custom shortcode should be doing. As long as the custom shortcode returns the correct results then it should filter the view.

What is the output of your shortcode when it isn't added to the view?

Please let me know.

Thanks,
Shane

#1371739

We're grabbing the ID's of attributes for products in the cat page.

When it's outside of the view it's outputting something like "4,16,73,56,91,103" as the ID for each attribute. And, we are using that dynamic [post-cat] to get the cat page we're on. It's working fine: [myShortcode catagory="[post-cat]" type="id"]

When inside the view it works until we add that [post-cat] -- maybe because it's 3 deep?
This works: [myShortcode catagory="power-tools" type="id"]
This doesn't: [myShortcode catagory="[post-cat]" type="id"]

Final shortcode looks like: [wpv-view name="myViewName" terms="[myShortcode category="[post-cat]" type="id"]"]

A view shortcode. Shortcode attribute is "terms" where I then use my shortcode. Then, try to dynamically set the category.

#1371741

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robina,

Have you added the post-cat shortcode to the views 3rd party arguments in Toolsets -> Settings -> Frontend?

If not then you need to added the shortcode as well.

Thanks,
Shane

#1372641

Sorry, that is just an example so you can understand what I am trying to accomplish.

We're using [wpv-view name="current-page-taxonomy-slug"] to pull the name of the page tax slug, which gives us:

[wpv-view name="myViewName" terms="[myShortcode category="[wpv-view name="current-page-taxonomy-slug"]" type="id"]"]

Changing the quotes single/double doesn't make a difference.

Thanks.

#1372701

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robina,

You are passing an entire view into your custom shortcode. Have you disable the wrapper on this view [wpv-view name="current-page-taxonomy-slug"]?

If not then you need to edit the view and then ensure that the checkbox is checked that disables the wrapper div. This checkbox should be below the loop output section.

Secondly test your shortcode like this only [myShortcode category="[wpv-view name="current-page-taxonomy-slug"]" type="id"] to ensure that your view only returns what you want.

I'm assuming this view [wpv-view name="current-page-taxonomy-slug"] returns the slug of the taxonomy of the current page. Then your custom shortcode here "myShortcode " returns the ID of the taxonomies?

Then you are passing these ID's into another view in order to filter that view by the same taxonomy ? Assuming that its similar posts to the current page or to display related posts based on the taxonomy?

The reason I ask this is because on your view [wpv-view name="myViewName" ] you can just add a taxonomy filter to the view and set that filter to filter based on the current page. You won't need to explicitly pass the ID's of the terms into the view because the filter will be able to automatically pick this up.

Please let me know.
Thanks,
Shane