Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › How to show short description for Pages in results
This topic contains 13 replies, has 2 voices, and was last updated by Ernest Marcinko 2 years ago.
- AuthorPosts
- February 26, 2021 at 7:49 am #31818
How can I get the search results box to show the descriptions for normal PAGES on our website. It is only showing pics and short descriptions for Posts (see attached where the top result is the Page ‘Break-through Protection’)
February 26, 2021 at 10:03 am #31822Hi,
If your pages have excertps or anything in their description fields, then those would show up. Make sure you have not changerd the primary and secondary description fields here: https://i.imgur.com/CEvO6RM.png
Best,
If the configuration is that, then there is no text within the page excerpts nor their content. If you are using some sort of a page builder, it may store the page contents somewhere else – like a custom field. Try maybe changing this option first: https://i.imgur.com/mtAiVTk.png
If the descriptions are printed via a shortcode it should help with that. Otherwise I assume it is stored in a meta field of some sort.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 26, 2021 at 11:22 am #31826Unfortunately, that suggestion did not work
February 26, 2021 at 12:15 pm #31827Can you add temporary FTP and back-end access to the site? If you want, I can check if there is anything I can do about it.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 26, 2021 at 12:22 pm #31828You cannot access this content.February 26, 2021 at 1:12 pm #31829You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 26, 2021 at 11:57 pm #31840Are you wanting FTP access or WordPress admin access? That FTP access I have given above of user: wpdreams and pw: N^e3r37d works fine for me when I check with Filezilla.
March 1, 2021 at 2:18 pm #31854Oh, sorry, that actually works, I wanted to try the back-end first.
Unfortunately I can’t see any content when requesting the page contents from WordPress, it returns simply nothing at all, an empty string. If you want, I can try checking the back-end for custom fields as well.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 2, 2021 at 2:12 am #31880I’m not an expert in knowing how WordPress pulls the data, so I can’t really comment. You could check the back end. So do you need WordPress login?
March 2, 2021 at 1:32 pm #31895You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 3, 2021 at 8:48 am #31924You cannot access this content.March 3, 2021 at 3:49 pm #31949Thanks!
I may have found a possible solution. I have added the following custom code to the functions.php file in your theme directory. Please keep it there:
add_filter('asp_results', 'asp_fg_results', 10, 1); function asp_fg_results($results) { foreach ( $results as $k => &$r ) { if ( $r->content == '' ) { $groups = acf_get_field_groups(array('post_id' => $r->id)); foreach ( $groups as $group ) { $fields = acf_get_fields($group['key']); foreach ( $fields as $field ) { $s = get_field($field['name'], $r->id); if ( !empty($s) ) { $r->content = wd_substr_at_word(strip_tags($s), 150) . '..'; break 2; } } } } } return $results; }
The page contents were indeed empty. Everything was build via ACF, which is unfortunately not searchable and is not returned when requesting the post content. The function above should take care of it to some extent.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 3, 2021 at 10:11 pm #31970That’s very good. Thanks so much for your help
March 4, 2021 at 10:07 am #31984You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.