Archive Image
This topic contains 7 replies, has 3 voices, and was last updated by Jonny Quinn 8 years, 2 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
January 10, 2017 at 6:10 pm #340480
Hi there, i was wondering if there was a simple way to achieve this without modifying the plugin core.
I have created a Logo Upload field and it is displaying nicely on the Detail Page Sidebar.
Now i would also like that to appear on the Archive Pages in the <div class=”geodir-post-img “></div>
I know i can add my Upload Field to appear in “Listings Page”, but it doesn’t display well and the post image still displays beside it. So ideally i would like the aforementioned div to display my custom image upload and not an image from the gallery/slider.
Thanks for any help you can offer
January 10, 2017 at 9:14 pm #340590Hi,
you’ll need to customize 2 templates:
listing-listview.php
and
widget-listing-listview.phpPlease see: https://wpgeodirectory.com/docs/customizing-geodirectory-templates/
Thanks
January 11, 2017 at 6:29 pm #341061Hi and thanks for your response. I’m having a bit of difficulty with the customisation.
So i’ve found the area that i need to change in listing-listview.php
<div class="geodir-post-img <?php echo apply_filters ('geodir_listing_listview_thumb_extra_class', '', 'listing'); ?>"> <?php if ($fimage = geodir_show_featured_image ($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?> <a href="<?php the_permalink(); ?>"> <?php echo $fimage; ?> </a>
So i’ve been experimenting with it in many ways but the closest i came was by simply changing
$post->featured_image
to
$post->geodir_logo
which is my custom field.
Unfortunately the html output is not quite right ..
<div class="geodir-post-img "> <a href="http://mysite.com/ designers/united-kingdom/lisburn/hillsborough/web-design/ fluid-studio/"> <div data-src="http://mysite.com/wp-content/uploads http://mysite.com/wp-content/uploads/2017/01/ 7947_geodir_logo_logo_green.jpg" class="geodir_thumbnail geodir_lazy_load_thumbnail" style="background-image: url(http://mysite.com/wp-content/uploads http://mysite.com/wp-content/uploads/2017/01/ 7947_geodir_logo_logo_green.jpg); opacity: 1;"></div> </a>
As you can see it is pre-pending
http://mysite.com/wp-content/uploads
to everything.
Could anyone please point me in the right direction to fix this ?Thanks agin for your help, it is greatly appreciated.
January 11, 2017 at 10:34 pm #341187I’ve flagged this for the developers, they’ll assist you asap.
Thanks for your patience,
January 12, 2017 at 2:56 pm #341434Hi Johnny,
I see two workarounds.
1) I’ll add a filter on our core. So you can modify the thumbnail image html using the filter.
2) There is already an action availble called
geodir_before_badge_on_image
after the following code
<div class="geodir-post-img <?php echo apply_filters ('geodir_listing_listview_thumb_extra_class', '', 'listing'); ?>"> <?php if ($fimage = geodir_show_featured_image ($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?> <a href="<?php the_permalink(); ?>"> <?php echo $fimage; ?> </a> do_action('geodir_before_badge_on_image', $post);
So you hide the default thumbnail with CSS and then use the action to add your new code.
Let me know which one you are comfortable with.
Thanks
January 12, 2017 at 3:37 pm #341486Hey Giri, thanks for your reply. I’m not sure i fully understand the second option. Is there by any chance a working example in any of the docs ? I appreciate this is free support, so maybe you don’t have the time to post examples.
But any further help is greatly appreciated.
Kind Regards
January 12, 2017 at 3:50 pm #341489I have not tested the follow code. So let me know if you face any problem.
function modify_geodir_featured_image($post) { if ($post->geodir_logo) { ?> <a href="<?php the_permalink(); ?>"> <img src="<?php echo $post->geodir_logo; ?>" /> </a> <?php } } add_action('geodir_before_badge_on_image', 'modify_geodir_featured_image');
January 12, 2017 at 4:08 pm #341493Thank you so much for your efforts. I tried the above function in my Theme functions.php and also in geodirectory_functions.php .. Unfortunately it didn’t seem to have any effect.
I truly appreciate your help, i realise it is above and beyond what should be expected.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket