Archive Image

This topic contains 7 replies, has 3 voices, and was last updated by  Jonny Quinn 7 years, 4 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #340480

    Jonny Quinn
    Free User
    Post count: 6

    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

    #340590

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    you’ll need to customize 2 templates:

    listing-listview.php
    and
    widget-listing-listview.php

    Please see: https://wpgeodirectory.com/docs/customizing-geodirectory-templates/

    Thanks

    #341061

    Jonny Quinn
    Free User
    Post count: 6

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

    #341187

    Paolo
    Site Admin
    Post count: 31206

    I’ve flagged this for the developers, they’ll assist you asap.

    Thanks for your patience,

    #341434

    Giri
    Expired Member
    Post count: 3155

    Hi 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

    #341486

    Jonny Quinn
    Free User
    Post count: 6

    Hey 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

    #341489

    Giri
    Expired Member
    Post count: 3155

    I 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');
    #341493

    Jonny Quinn
    Free User
    Post count: 6

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

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

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

Open Support Ticket