Image SEO

This topic contains 10 replies, has 3 voices, and was last updated by  Stiofan O’Connor 7 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: ,

  • Author
    Posts
  • #377883

    Neil Hall
    Buyer
    Post count: 83

    I am trying to increase the SEO for the images that are posted through the front end of the website, and was wondering if anyone had come up with a solution for Geodirectory. I have done a lot of searching, but there does not seem to be a reasonable solution. One of the problems that we have is that a lot of attached images are from mobile devices. This results in very unfriendly image filenames, for example 608_20170510_133824.jpg, and if we use this for the ‘title’ or the ‘alt’ then it will not help much. I know that I can manually alter these fields, but being a lazy person I would like to find a way of automatically changing the image filename, the title and the alt

    I have been looking at two ways to possibly solve this.

    The first is trying to find a plugin or code that would alter the image file name to the ‘post title’ at the time time it is uploaded in the frontend. So far I have not been able to find a solution. The closest I have come up with is Media File Renamer https://meowapps.com/media-file-renamer/ in the Pro version it claims to be able to rewrite the filename based on the post title, but this would be done in the backend.
    1. Does anyone have experience of using this with Geodirectory
    2. Has anyone managed to find another solution to rewriting the file name.

    The other approach I have taken is to find a plugin or code that can automatically set the Image Title and Alt. Again the closest that I have come up with is PB SEO Friendly Images https://wordpress.org/plugins/pb-seo-friendly-images/ This seems to work well with standard ‘post’ images, but does not seem to work well with the Geodirectory structure.
    3. Has any one had experience of getting PB SEO Friendly Images to work with Geodirectory CPT
    4. Has anyone managed to find another solution on how to automatically rewrite the Image Title and Alt?

    5. To follow on from this I’d like to know if this is a feature the Geodirectory would be likely to implement as standard at sometime. Reading through the forum it has been mentioned a few times.

    #377965

    Paolo
    Site Admin
    Post count: 31206

    I don’t think you’ll find anything that will work out of the box, because we don’t use the WordPress media uploader.

    However I asked to the developers if they have any idea about any possible workaround.

    They’ll let us know asap.

    Thanks

    #378337

    Neil Hall
    Buyer
    Post count: 83

    Hi Paolo

    Many thanks. I’ll be very interested if there is a solution

    Best Regards
    Neil

    #378346

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Neil,

    Do you mean the images in the slider? If so i could add a filter to let the title and alt be changed on the fly?

    Stiofan

    #378376

    Neil Hall
    Buyer
    Post count: 83

    Hi Stofian

    If you mean the images in the slider on the listing-detail.php then yes that would be very useful.

    I also want to set the title and image withing the widget-listing-listview.php and the listing-listview.php where the geodir-post-img is found

    Best Regards
    Neil

    #378801

    Neil Hall
    Buyer
    Post count: 83

    Hi Stiofan

    I think I have managed to solve the ‘alt’ and ‘title’ for the images that are displayed in the widget-listing-listview.php and the listing-listview.php where the geodir-post-img is found. I’m sure there must be a better way of doing it but I edited the post_functions.php near line 1636 to this:

    
    
    $image_alt = get_the_title($post->ID);
    			$image_title = get_the_title($post->ID);
                    if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
                        $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
                    } else {
                        if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
                            $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');" alt="place image"></div>';
                        }else{
                            //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
                            //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
                            $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" alt="Latest reviews on '.$image_alt.'" title="'.$image_title.'"></div>';
    
                        }
    
                    }
    

    I just need to crack the listing-detail.php

    Best Regards
    Neil

    #378968

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You should avoid editing core files, changes will just be overwriten when you update.

    If you are using lazyload images then the images are loaded dynamically so i don’t think it is needed.

    For the details or for most images i have added a filter “geodir_get_images_arr” which will be in next ver which will allow you to filter the images array.

    Stiofan

    #382279

    Neil Hall
    Buyer
    Post count: 83

    Hi Stiofan

    Was the “geodir_get_images_arr” filter added in version 1.6.20. If it was how do I use it.

    Best Regards
    Neil

    #382297

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    not tested properly but something like this

    
    
    
    add_filter('geodir_get_images_arr','_my_img_alts');
    function _my_img_alts($img_arr){
    
    	if(!empty($img_arr)){
    		global $post;
    		foreach($img_arr as $key => $val){
    			$val->title = $post->post_title;
    			$img_arr[$key] = $val;
    		}
    	}
    	return $img_arr;
    }

    Thanks,

    Stiofan

    #382512

    Neil Hall
    Buyer
    Post count: 83

    Hi Stofian

    I added the code to my functions.php and gave it a quick test. It appears to work only with the image slider on the listing-detail page. Is this correct?
    In these images I saw it changes the image meta title to the post title, and also the Alt text to the image title, which is a good start.
    What would be nice is if you could add additional text to the Alt text. For example ‘Check out the latest reviews on ‘post title”. Would something like that be possible too

    And following on from this if this function could be extended to the widget-listing-listview.php and listing-listview.php it would be great.

    Best Regards
    Neil

    #382524

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You can change it to whatever you like with this line

    $val->title = $post->post_title. " more text here";

    The other listing images are background images not img tags, i have added a title attribute that will be affected by the filter above also. It will be in the next release.

    Thanks,

    Stiofan

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount