Skip Navigation

[Resolved] Caption from post shows in different view excerpt

This support ticket is created 7 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 10 replies, has 2 voices.

Last updated by bryanC-2 7 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#449906

I am trying to: get rid of caption from other view that is in excerpt on the home page of a list of posts

I visited this URL: local host

I expected to see: no caption

Instead, I got: Get caption

Created video here to explain in detail. hidden link

Thanks
Bryan

#450143

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

The video file you shared here is not working at this end. Could you please try to resend it or explain in detail what's your issue and where and what you want to display at which place? Few screenshots will be helpful to understand your issue.

#450329

I'm sorry please try this one hidden link

#450385

Here are the views if needed "news" is the front page view.

hidden link

#450420

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I need to check on your install why its displaying caption with post description. This must be related to CSS issue but to ensure that:

1)
Please share problem URL.

2)
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#450846

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thank you for sharing access details.

Well - I do see the caption under the image:
hidden link

Am I missing anything here. Could you please describe where exactly you would like to display the image caption?

#451176
homepage-latest-posts.jpg
Individual-post.jpg

What is happening is that the individual post image caption on the single post itself is showing up on the homepage under the latest posts view (news) at the beginning of the excerpt for that post.

I added images to explain.

i hope that makes it clearer

#451282

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ahh - I can see now.

Well - its default behaviour from WordPress. Please check following Doc:
=> https://developer.wordpress.org/reference/functions/the_excerpt/
[ Section "More information"]

In last paragraph there is a note about this:

Note: If the current post is an attachment, such as in the attachment.php and image.php template loops, then the attachment caption is displayed. Captions do not include the "[…]" text.
#452179

I still haven't closed this yet because i haven't figured quite yet how to fix this. I've found a couple snippets to make adjustments in the functions.php file but nothing has quite worked yet. I'm optimistic on fixing this but still investigating. Any additional tips are are welcome.

Thanks
Bryan

#452549

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You may try to wrap you caption with DIV and use CSS to show/hide the caption.

#452857

I figured it out. I put this code in my functions.php file resolved my issue. It is specific to views. Might be worth posting on an FAQ or something.

//* This fixes the issue where the individual post image caption show up on excerpts
add_filter('wpv_filter_post_excerpt', 'my_caption_func');
function my_caption_func($excerpt){
return $excerpt = preg_replace('#([[]caption)(.*)([[]/caption[]])#e', '', $excerpt);
}
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.