Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › How to show short description for Pages in results
- This topic has 13 replies, 2 voices, and was last updated 5 years, 3 months ago by
Ernest Marcinko.
-
AuthorPosts
-
February 26, 2021 at 7:49 am #31818
malkay72
ParticipantHow 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 #31822Ernest Marcinko
KeymasterHi,
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
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.February 26, 2021 at 11:22 am #31826malkay72
ParticipantUnfortunately, that suggestion did not work
February 26, 2021 at 12:15 pm #31827Ernest Marcinko
KeymasterCan 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.
February 26, 2021 at 12:22 pm #31828malkay72
ParticipantYou cannot access this content.
February 26, 2021 at 1:12 pm #31829Ernest Marcinko
KeymasterYou cannot access this content.
February 26, 2021 at 11:57 pm #31840malkay72
ParticipantAre 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 #31854Ernest Marcinko
KeymasterOh, 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.
March 2, 2021 at 2:12 am #31880malkay72
ParticipantI’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 #31895Ernest Marcinko
KeymasterYou cannot access this content.
March 3, 2021 at 8:48 am #31924malkay72
ParticipantYou cannot access this content.
March 3, 2021 at 3:49 pm #31949Ernest Marcinko
KeymasterThanks!
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.
March 3, 2021 at 10:11 pm #31970malkay72
ParticipantThat’s very good. Thanks so much for your help
March 4, 2021 at 10:07 am #31984Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts
- You must be logged in to reply to this topic.