Skip Navigation

[Résolu] Read more link on Exerpts not showing when there is no body text

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

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 12 réponses, a 4 voix.

Dernière mise à jour par Jim Il y a 4 années et 9 mois.

Assisté par: Shane.

Auteur
Publications
#1526649

Jim

I have created a view that shows exerpts of posts.
But some posts only have an image or video and then the exerpt does not show the 'Read more' button.

Is there a way to always show the Read more button no matter how little text there is in the post?

#1526863

The excerpt is produced by WordPress from the Post Body unless you provide an excerpt manually.
If you have no post content, you can add the Excerpt manually and then Toolset ShortCode will use that instead

Does this help?

#1526893

Jim

Not sure exactly what you mean by adding the exerpt manually...
I use the Toolset shortcode [wpv-post-excerpt length="22" count="word"] in my view.

And ofcourse I can add a read more button to my view manualy, but then when the exerpt adds one there are two.

So is it possible to control with the shortcode to or always show the read more button or never, so I can add it.

#1527055

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Jim,

With the [wpv-post-excerpt length="22" count="word"] shortcode you can just add the more: attribute to add the read more.

Example
[wpv-post-excerpt length="22" count="word" more:"Read More"]

For mroe information on this shortcode see the documentation below.
https://toolset.com/documentation/user-guides/views/views-shortcodes/#vf-153377

Thanks,
Shane

#1527059

Jim

Hi Shane, thanks but that is not the question.

The problem is that the shortcode does not display the "Read more" button when there is no text in the post.
Please read above.

Thnx
Jim

#1527061

Jim

So: I need the "Read more" button on every exerpt, even if there is no text.

#1527319

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Jim,

In this case you should insert it manually then. This is because your [wpv-post-excerpt length="22" count="word"] will use the post body instead if there is no excerpt explicitly defined as Beda had mentioned.

When a more parameter isn't defined by the shortcode then it defaults to just "..."

Thanks,
Shane

#1527327

Jim

Hi Shane, yes but then I have two 'read more' buttons (most of the time)... right?

I am sorry but Is my question so difficult to understand?

Is it possible to output an exerpt to;
- always show the read more button
- or never; that way I can add it manually without the button showing up twice when there is text in the post body

Or any other solution that achioefs the same result.

I hope this is more clear?

#1527331

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Jim,

You wont have multiple read more buttons if you don't provide the "more" attribute to the shortcode.

However in a direct response to your question. No it is not possible to have this.

You mentioned this previously "The problem is that the shortcode does not display the "Read more" button when there is no text in the post."

In a case like this not sure why you would want to have a read more button rather linking it directly with the post title.

However you can make use of our conditional code to check if the post has content.
https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-custom-functions-in-conditions/#checking-for-empty-post-content

This way you can switch between your manual display and the auto display.

Thanks,
Shane

#1527411

Jim

Well, the reason I would like to link to such posts is that they display an image of video. So there is content, just no text.

And I was not using the more attribute, only [wpv-post-excerpt length="22" count="word"], but it does display a read more button.

But now I understand that there isn't supposed to be a RM button by default! Ah.

Well then my theme is adding the button and that explains the confusion.

#1529257

Hi, Shane is out today for a national holiday and will return tomorrow to continue assisting you.

#1530609

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Jim,

Is there any other questions on this that I can clarify for you ?

Thanks,
Shane

#1531143

Jim

My issue is resolved now. Thank you!

I found that my theme was indeed adding the Read More buttons to the excerpts.
That created the whole confusion and not understanding eachother.

Thnx