Michael
Forum Replies Created
-
AuthorPosts
-
Hi Stiofan,
That works perfectly. Thanks for the help.
Michael
Hi Stiofan,
Thanks for the code, but it doesn’t seem to do anything. Neither using the default category or specifying a specific category.
I notice you are using “geodir_related_posts_widget_query_args”
The Related Listing I’m talking about is the one that displays at the bottom of the details page,
Design > Detail > Related Post SettingsNot the one you setup using a widget. Is there a different filter for the area I’m talking about?
Here’s the code that doesn’t work, the original was missing a “)”
add_filter('geodir_related_posts_widget_query_args','_my_gd_related_filter',10,2); function _my_gd_related_filter($query_args, $request){ if(isset($query_args['tax_query']['terms'])){ global $post; $query_args['tax_query']['terms'] = array($post->default_category); } return $query_args; }
Thanks
Okay, thank you.
It’s probably not best, but it works for 99% of what I need. Unfortunately, any of the photos that aren’t set as featured images don’t have the smaller thumbnail version automatically created, so those all need to be manually uploaded.
I went ahead and found the code to make this work. For future reference I’ll link it here. The function is in post_functions.php starting on line 1550. My custom code starts on line 1600
// Custom Thumbnail Size Here // $t_image = $image->src; $t_image = substr( $t_image, 0, -4 ); // This should be the hardcropped extension to add to the end of image. // $t_image .= '-480x320.jpg'; if (!is_wp_error($max_size)) { if ($image->width) { if ($image->height >= $image->width) { $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2); } else if ($image->width < ($max_size->h)) { $width_per = round((($image->width / $max_size->w) * 100), 2); } else $width_per = 100; } // All instances of $image->src have been changed to modified $t_image // if (is_admin() && !isset($_REQUEST['geodir_ajax'])){ $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $t_image . '" /></div>'; } else { if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){ $html = '<div class="geodir_thumbnail" style="background-image:url('' . $t_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',$t_image).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>'; } } }
Deferred loading or not, it would be nice to not have to load the full size image when a smaller thumbnail version would be sufficient. Thanks
So I finally give up and ask for help, then 5 minutes later I fix the problem.
Don’t know how it happened, but something got screwy with all the published posts. I went through and changed the status from Published to Pending and then back to Published, that seemed to fix whatever went wrong.
Thanks.
Okay thanks.
Okay thanks for the help.
This reply has been marked as private.Okay great, thanks for the help.
This reply has been marked as private.This reply has been marked as private.This reply has been marked as private.This reply has been marked as private. -
AuthorPosts