Skip Navigation

[Resolved] Call archive view with shortcode

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.

Tagged: 

This topic contains 6 replies, has 3 voices.

Last updated by Shane 1 year, 2 months ago.

Assigned support staff: Shane.

Author
Posts
#1728629

Hi,
I have an archive view that I needed to copy entirely into a simple view.
I use both, but would like, in order to avoid duplicates, to use the Archive view as a shortcode instead of using the simple view.
How would this be possible ?
Thank you.

#1728753

Shane
Supporter

Languages: English (English )

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

Hi Roman,

Thank you for getting in touch.

Are you creating your view with a content template attached? Meaning you are using the classic method to create your view?

What you can do is to call the content template of your archive inside the new view that you create so you wouldn't need to create a new template for each of the views that you created.

Thanks,
Shane

#1729239

Hello and thank you,
I am already using a common content template for both the archive view and the simple view, but :
- that doesn't help for the query and filters;
- that still makes 2 different views instead of a single one;
- that causes several strange bugs.
It would be better to be able to call the archive view with a shortcode.
Thank you.

#1729927

Hi, Shane is out today on a public holiday and will return tomorrow to continue assisting you. Thanks for your patience.

#1730925

Shane
Supporter

Languages: English (English )

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

Hi Roman,

It would be better to be able to call the archive view with a shortcode.

Unfortunately because of the way how archives work it wouldn't be possible to call the archive itself using a shortcode.

This is because the custom archives interact directly with the wordpress archive template itself and overwrites it directly rather than using a shortcode.

Only a view will generate a shortcode that can be used on multiple pages.

Thanks,
Shane

#1731223

I understand, thank you.
Is there any way to code a function that would create a shortcode able to call the archive view ?
If so, could you please point me the documentation ?
Thank you.

#1731309

Shane
Supporter

Languages: English (English )

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

Hi Roman,

Unfortunately not, we don't have any API functions that can be used to do this.

Here are the functions below that can interact with a view.
https://toolset.com/documentation/programmer-reference/views-api/

However these are strictly for views and won't work for custom archives.

Thanks,
Shane