Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Not indexing pages / user meta image
- This topic has 13 replies, 2 voices, and was last updated 3 years, 9 months ago by
Ernest Marcinko.
-
AuthorPosts
-
August 11, 2022 at 1:00 pm #38812
Danny Wisholm
ParticipantHi support (Ernst?)
I have 2 questions:
1) I don’t think my plugin indexed “pages” – can you help with the correct settings?
2) I would very much like to be able to use an image from a user user meta field – just like I can use custom “Advanced title field for User results” and “Advanced description field for User results” – When finding users i’ll like to use “meta_logo” field – Can you help with a solution, or does the option already exist?
Best regards
Danny Wisholm
Wisholm DATAAugust 11, 2022 at 1:51 pm #38814Danny Wisholm
ParticipantYou cannot access this content.
August 12, 2022 at 9:31 am #38819Ernest Marcinko
KeymasterHi Danny,
Thank you very much for all the details, it helps us a lot!
1. I checked everything, but the configuration is okay. I tried to search a few queries for specific pages, and it worked, for example Det Sker Kalender.
2. I assume you mean the images on the results page. Unfortunately the plugin can not affect that. In the live results list, if the plugin finds an image, it will display it, but the results page elements are printed by the theme. There are theme API functions, which can be used in the theme loop – those will help fetching the same fields as in the live results list, including the image fetched by ajax search pro.
August 12, 2022 at 10:00 am #38821Danny Wisholm
ParticipantYou cannot access this content.
August 12, 2022 at 11:04 am #38828Danny Wisholm
ParticipantYou cannot access this content.
August 12, 2022 at 12:28 pm #38832Ernest Marcinko
KeymasterHi,
Can you please check the login details?
I may have found a possible bug in the HTML extraction, which will definitely fix the missing results with the index table engine, I think I can fix that.For the live results, you can actually use meta field as image for post types here: https://i.imgur.com/Cytm0DY.png
For user meta, there is still a way via custom code:
add_filter( 'asp_results', 'asp_get_custom_cf_image', 10, 1 ); function asp_get_custom_cf_image( $results ) { $field = 'user-image-url'; // Enter the user meta field containing the image foreach ($results as $k=>&$r) { if ( $r->content_type == 'user' ) { $val = get_user_meta($r->id, $field, true); if ( !is_wp_error($val) && !empty($val) ) { if ( is_array($val) ) { $val = reset($val); } if ( $val != null && $val != "" ) { if ( is_numeric($val) ) { $im = wp_get_attachment_image_url( $val ); } else { $im = $val; } $r->image = $im; } } } } return $results; }Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
In the above code change the $field name to the meta field name.
August 12, 2022 at 12:50 pm #38833Danny Wisholm
ParticipantYou cannot access this content.
August 12, 2022 at 1:17 pm #38834Danny Wisholm
ParticipantYou cannot access this content.
August 12, 2022 at 1:18 pm #38835Danny Wisholm
ParticipantYou cannot access this content.
August 12, 2022 at 1:37 pm #38838Danny Wisholm
ParticipantYou cannot access this content.
August 12, 2022 at 1:55 pm #38839Ernest Marcinko
KeymasterThanks!
The snippet is actually working for the live results, I believe those are the images from the meta field: https://i.imgur.com/skfVBMY.png
For the results page, that is way more difficult, especially with Elementor. I don’t think there is currently a way to add images from URL to the relementor results cards. Elementor does not have a hook for that. I believe the final image HTML code can be altered, but that is not the best approach for a generic solutionI have fixed the issue with the index search, now the missing results should show up.
August 12, 2022 at 2:05 pm #38841Danny Wisholm
ParticipantYou cannot access this content.
August 13, 2022 at 11:29 am #38848Danny Wisholm
ParticipantYou cannot access this content.
August 13, 2022 at 1:37 pm #38849Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts
- The topic ‘Not indexing pages / user meta image’ is closed to new replies.