Skip Navigation

[Resolved] Automatic excerpt

This support ticket is created 5 years, 6 months 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by PZ 5 years, 6 months ago.

Assigned support staff: Beda.

Author
Posts
#546978

PZ

Hi, I need a hint. Look at hidden link there you can see my custom posts excerpts.

The character string below:
"Cena: [34900 PLN]
Moc silnika: [204 KM]
Pojemność: [3 l diesel]"

I put manually in the excerpt of every post added. The characters in [ ] brackets are variables retrived from each post.

My problem is that after each post submission I need to add the code to the excerpt of each post manually. How to make it done automatically? I can't use the more tag or any known plugin because neither the first paragraph nor the fixed characters number matches what is shown in the excerpt although the data I want to show are inside the post (and they are taken from there).

#547233

You can not get data automatically without having a very specific place where you can grab it.

If that data is stored in Custom Fields (as example single Lines) you could add them to the content with the Toolset ShortCode for the Custom Fields, but that will not work in Excerpts as those do not support ShortCodes at all, unless you joggle with Custom Code:
https://wordpress.org/support/topic/how-to-execute-shortcode-in-excerpt-fields/

What I suggest is:

1. Store the variable Data in a (or several) custom fields
2. Use a WYSIWYG Custom Field to display what you usually display in the Excerpt and insert the Toolset ShortCodes there.
3. Call this WYSIWYG Field anywhere you need it with the Toolset ShortCode for this Field.

Please let me know if you need more help with this.

#548757

PZ

What you proposed works perfectly as it is, of course. The thing is that I tried to display that custom data in an Elementor's widget which calls exclusively for the excerpt. So in a single post I still need to manually put the data in the manual excerpt field.
I wonder if there's any chance to get it to work as I wish...

By the way the tollset shortcodes for the custom fields did work with the excerpt field.

Anyway, great thanks for your help again.

#548758

Excerpts do not execute ShortCodes unless you use Custom Code.
https://wordpress.org/support/topic/how-to-execute-shortcode-in-excerpt-fields/

So maybe you added already something that makes ShortCodes executable in Excerpts?

Anyway, ShortCodes are the only way to get that Data dynamically.
So, you need to store that data in ShortCodes or use Custom Code to get it, which I can not assist, I am afraid.

Thank you

#549774

PZ

Thanks a lot for your help.