Not indexing pages / user meta image

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Not indexing pages / user meta image

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

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #38812
    Wisholm DATA
    Wisholm DATA
    Participant

    Hi 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 DATA

    #38814
    Wisholm DATA
    Wisholm DATA
    Participant
    You cannot access this content.
    #38819
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi 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.

    Best,
    Ernest Marcinko

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


    #38821
    Wisholm DATA
    Wisholm DATA
    Participant
    You cannot access this content.
    #38828
    Wisholm DATA
    Wisholm DATA
    Participant
    You cannot access this content.
    #38832
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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.

    Best,
    Ernest Marcinko

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


    #38833
    Wisholm DATA
    Wisholm DATA
    Participant
    You cannot access this content.
    #38834
    Wisholm DATA
    Wisholm DATA
    Participant
    You cannot access this content.
    #38835
    Wisholm DATA
    Wisholm DATA
    Participant
    You cannot access this content.
    #38838
    Wisholm DATA
    Wisholm DATA
    Participant
    You cannot access this content.
    #38839
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thanks!

    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 solution

    I have fixed the issue with the index search, now the missing results should show up.

    Best,
    Ernest Marcinko

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


    #38841
    Wisholm DATA
    Wisholm DATA
    Participant
    You cannot access this content.
    #38848
    Wisholm DATA
    Wisholm DATA
    Participant
    You cannot access this content.
    #38849
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


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

The topic ‘Not indexing pages / user meta image’ is closed to new replies.