Sauter la navigation

[Résolu] Creating a paragraph of text that contains multiple shortcodes

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I would like to use shortcodes like wpv-post-title and wpv-post-taxonomy but they seem to be written out to the page instead of parsed.

Solution: Be sure to activate Blocks or Views to use the wpv- shortcodes.

This support ticket is created Il y a 3 années et 10 mois. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 6 réponses, a 2 voix.

Dernière mise à jour par barryG-4 Il y a 3 années et 10 mois.

Assisté par: Christian Cox.

Auteur
Publications
#1942619

Tell us what you are trying to do?
On a Toolset Custom Post Type template page (built using Elementor) I want to display a paragraph of text built around shortcodes referring to Toolset custom fields and Toolset custom taxonomies. Here is the current failed attempt which is in an Elementor Text Editor element:

[wpv-post-title] is a [wpv-post-taxonomy type="nationality" format="name"] escort. She is [types field='age'][/types] years old with a [types field='statistics'][/types] figure. She offers full personal escort services in a private and very discreet apartment in Tower Bridge London.

This currently outputs:

[wpv-post-title] is a [wpv-post-taxonomy type=”nationality” format=”slug”] escort. She is 25 years old with a 34DD-24-34 figure. She offers full personal escort services in a private and very discreet apartment in Tower Bridge London.

So you can see that the toolset types field shortcodes for age and statistics work perfectly but the post title and taxonomy shortcodes fail. May I know how to fix this please. I've spent hours googling and trying things out without success.

Is there any documentation that you are following? No

Is there a similar example that we can see? No

What is the link to your site? Excuse the content. It's template for a UK escort agency. lien caché

#1942883

Hi, the shortcodes that begin with wpv- are provided by Toolset Blocks or Toolset Views, so your site would need to have either Toolset Blocks plugin or the Toolset Views plugin installed and active. My first guess is that you have Toolset Types active but not Views or Blocks?

If that is the case, you must activate either Blocks or Views to use the wpv- shortcodes. If that is not the case, I'll need to do a bit more investigation because it's unusual that those shortcodes would be simply written out. Normally if they return no values, they would be hidden on the front-end.

I suggest temporarily activating a default theme like Twenty Twenty One, then deactivating all plugins except
Types
Views or Blocks
Elementor

...and test again. Let me know the results of that test, and please provide your site's debug information as explained here: https://toolset.com/faq/provide-debug-information-faster-support/

I'll take a look and give you some feedback.

#1943463
Screenshot 2021-02-12 at 11.28.11.png
Screenshot 2021-02-12 at 11.28.43.png

Hi Christian, You are right that I hadn’t activated Blocks or Views. I then did activate Blocks but Views wasn’t in the list. Then the shortcodes I’d created (generated in another site using Views so I could work out what shortcodes I needed) just started to work as if by magic. So without creating a View inside a Content Template and just by activating the Toolset Blocks plugin, I now have what I need.

That’s surely not what I need to do though. I should be using Blocks and a View inside a Content Block.

I dutifully created a content template and then made a mistake. I added a fields and view block and constructed a paragraph using fields and text. It was not so easy to do as after each field was entered, the cursor wouldn’t move forwards to allow me to start typing text. Anyway, I managed to finish it eventually and using ‘View With’ set to Kelly (the model post title) all the text worked within the editing page.

However, I then realised my mistake as I needed to create a View first to be able to then use the Elementor add ‘View’ element and select a View to display the text on the custom post page.

So I deleted the content template I had been working on and started again.

I created a View within the template and selected ‘models’ as the custom post type for what it would be used for and manually typed out the paragraph in a fields and views block with xxx representing where the shortcodes would go. This saved the error I encountered earlier where the cursor wouldn’t click in front of shortcode after entering one using the ‘Add File Or View’ button and selecting one from the list. I then replaced the xxx’s with the shortcodes and saved but the text doesn’t show Kelly’s data. Using the same View With set as Kelly nothing works like it did using the exact same fields but outside of a view. The result on the post p[age is ‘No Items Found’.

So…..using shortcodes within an Elementor Text Editor element, edited from another website, works when Toolset Blocks is activated but…

….going through the really complicated process (to me) of creating a Content Template, creating a View inside it then struggling to get text entered after adding views because of the cursor issue….fails.

I would really love to get to the point that I am confident using views and blocks but I cannot even see that views is activated, cannot get a content template with a view to work and have trouble getting the view created and I don’t think I’m doing anything I shouldn’t. I’m going to try to record a video of the whole process to show you but for now, can you tell if I’m making a really simple mistake that is stopping things from working the way it should?

Many thanks,
Barry.

#1943523

Hi Christian,

Here's a link to a video showing you the full process of creating and failing with the Content template and View within it. You won't have time to watch all of it and it's tedious anyway but at 1.44 mins in you'll see me struggling with the cursor going back to the start of the paragraph each time I try to add anything after a field was added and if you then fast forwards to 6.30 you'll see the process coming to an end when the cursor simply refuses to go anywhere further than after the last field I entered. I'm sure it's just me but Content Templates and Views simply do not work and I can't go forwards until I know what I'm doing wrong. I'd be very grateful if your patience will extend to helping me get over this problem. Many thanks, Barry.

lien caché

#1945861

Hi Christian,

May I know if you tried anything to fix the issue because I've just added a new model to test things out with and I can now see that the text is displaying on both girls' profile pages as it should do. I didn't touch anything so I'd love to know if you fixed it?

Many thanks,
Barry.

#1947841
inline-field.png

May I know if you tried anything to fix the issue because I've just added a new model to test things out with and I can now see that the text is displaying on both girls' profile pages as it should do.
Hi, no I was off Friday and Saturday and I haven't logged into the site or anything to try to diagnose a problem. I understand the process for creating Views is a bit convoluted in the current system if you're planning to use the View elsewhere on the site, like in an Elementor template. One workaround for this is to enable the legacy Views editing experience in Toolset > Settings > General tab. There is an option in Editing Experience that will enable both the Blocks system and the legacy system. When you choose that option, you will be able to go to Toolset > Views and create a View independently of the Block editor. It's an older method of creating Views that is still supported. Our developers are working on improving the Blocks experience so that Views can be created more easily in an independent way without requiring this setting.

Regarding the editing issue with the Fields and Text block, we've added some new dynamic inline field options to the basic paragraph block provided by WordPress and addressed some usability issues with the Fields and Text block. If you're typing in a WordPress basic paragraph block now, hover your mouse over the block and you should see the inline field icon above the editor area (screenshot). It's much more user-friendly than the Fields and Text block, though I have noticed one minor issue when trying to edit the preceding text after inserting a dynamic field. Clicking out of the block and clicking back into the block solves that problem for now, but our developers are working on a fix.

If you're still having trouble working in the block editor interface, I'll be glad to log in and take a closer look. Please provide login credentials in the private reply fields here and let me know where to see the issue.

#1949325

Hi Christian, thank you for explaining that. I'm going to use Views in a way that I'm more used to for now. Hopefully I'll revisit Content Templates when any niggles have been ironed out.

Many thanks,
Barry.