Skip Navigation

[Résolu] Two different shortcode types

This support ticket is created Il y a 6 années. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 2 réponses, has 2 voix.

Last updated by Stephen Vaughan Il y a 6 années.

Assisted by: Nigel.

Auteur
Publications
#627956
Editing-a-year.jpg
Shortcode-for-the-Shortcodes-text-area-field-in-the-custom-template.jpg
Template-for-years.jpg

My enquiry is one of curiosity and a second set of eyes to see if I am might run into trouble with my approach.

I notice since the update to Views last year that had the new integration with Divi that there are now two versions off the shortcodes for fields.

[wpv-post-title] and {!{wpv-post-title}!}

Predominantly the curly braces version {} is new when used for building custom templates using Divi. I have also been able to use these for use elsewhere. This may never have been the intention of the plugin developers. For example you can put {!{wpv-post-title}!} into the formatter of the Divi form module and when a email is sent the title of the page is shown in the message.

Just so you know, I have been able to use the old shortcodes for archive views directly in regular pages using the Divi builder for quite some time, even prior to the new Divi integration late last year.

I have added some screenshots to give some clarity to what I am talking about.

Here is a link to the end result on the front end.

hidden link

I converted the above this morning so that the Years are now rendered from a centralised template using Custom Templates and the Divi integration. This was quite easy to do. About 40 minutes work to convert 19 Year pages over and then using Duplicator to do backup and install of the whole site on my localhost machine as a copy.

I added a new text area field, in the field group for this type, as a place to add the shortcodes, for the prints type filtered archive view and then another for the buttons, a simple archive view of links to each year.

By the way, and I did ask before, it would be handy if we could have the Toolset shorstcodes item in the admin bar on the front end when using Divi's visual builder.

Have a think about what I am doing and let me know if you see any pitfalls in what I am doing.

#628182

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01:00)

Hi Stephen

I'm not sure I have understood the question about re-organising your work.

Looking at your site it appears to be working, so it evidently is possible, though I don't really understand what you say about using custom fields to store shortcodes.

What you are displaying essentially looks like a taxonomy archive, where each year would be a taxonomy term, and you make one custom WordPress archive for the post taxonomy archive which means when you enter the URL site.com/print-year/2016 or similar you will see the archive of prints from 2016.

You can use a taxonomy View to generate the links to the different archives.

Regarding the different styles of shortcodes, the curly brace shortcodes were introduced because there are certain circumstances with page builders where the normal square bracket shortcodes are not rendered, and the curly-brace format is our solution for that. Square brackets typically will still work, and on an existing site with square brackets where you add new shortcodes, you may see a mix of both types on the same page.

I will ask about making the Toolset shortcodes menu on the admin bar available on the front-end.

#628203

Hi Nigel

Apollogies if I wasn't very clear. Probably if I want to get a quick archive on a page I would use, I could go for URL hidden link for the year 2015.

But as not all themes are the same and in this case with Divi you just get the archive but no title. And I want to add the buttons for the other years as navigation. My solution was to create year pages with a Toolset Divi template and with a Title module and text module where I have a shortcode for a field made in my print year field group that takes the shortcodes for archives view i have made for each year and my nav buttons for years. Yes it is a bit of a round about way of doing it.

You comments though have given me pause for thought and looking at the WordPress archive again and trying things out I see that I can add into that shortcodes before and after the [wpv-layout-start][wpv-layout-end] block. So I can add the shortcode for my buttons below the output for the archive and at the top the title. I see that ultimately this is a more sensible way to do this than what I have been doing. I just need to get the title of the page to be the parent year. Currently I am getting the title of the first item in the archive. I will work on this approach and adopt it for future projects.

Just one more thing. My initial post was to include what I may have been experiencing as a bug. When I was updating my Years and getting a shortcode for my 2018 archive view I was getting the curly braces shortcode when I was expecting the square brackets version. This didin't render the archive. Instead it just showed the shortcode so I manually edited it to be square bracketed. When I went to double check, on opening the ticket it was functioning properly again, and I haven't been able to reproduce the output of the curly braces again. I will keep an eye out and let you know if it happens again.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.