Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › How to show "Caption" in "Advanced Description Field"? › Reply To: How to show "Caption" in "Advanced Description Field"?
January 8, 2021 at 1:46 pm
#31052
Keymaster
Hi,
Thank you for all the details, it helps us a lot!
1. The image captions are stored as the excerpt, so you can use this configuration for it: https://i.imgur.com/knhDwNP.png
In that case, the {titlefield} pseudo variable will contain the excerpt, which is the caption.
2. That is only possible programmatically via the asp_results filter hook. Based on your description, something like this for a custom code:
add_filter( 'asp_results', 'asp_parent_content_to_attachment', 10, 1 );
function asp_parent_content_to_attachment( $results ) {
foreach ($results as $k=>&$r) {
if ( $r->content_type == 'attachment' ) {
$r->content = get_the_title( wp_get_post_parent_id($r->id) );
}
}
return $results;
}
I have not been able to test this, but it should be close to an actual solution.