How to show "Caption" in "Advanced Description Field"?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to show "Caption" in "Advanced Description Field"?

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #31048
    Taufan
    Taufan
    Participant

    Hi Ernest,
    I try to “Enabling Attachment Search”.

    Question 1:

    How to show Image “Caption” in “Advanced Description Field”?

    I try: {captionfield} or {caption} but non of them working.

    Question 2:

    My Gallery have an Attachment Page, all of them have a parent page.
    How to show “Parent Page Title” in “Advanced Description Field”?

    Later, i will ask you “Parent Custom Field”.

    That’s all..
    Thank’s for your explanation.
    I really appreciated.

    #31052
    Ernest Marcinko
    Ernest Marcinko
    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.