Display Featured Image on Detail Sidebar

This topic contains 6 replies, has 4 voices, and was last updated by  Paolo 8 years, 10 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #27931

    insomniacuva
    Free User

    Hello,
    Can you please help me display the Listing’s featured image on the Detailed Page Sidebar?

    Should be fairly easy but I’m having a lot of trouble.

    I’ve tried messing around with geodirectory_hooks_actions.php but not really getting anywhere.

    Please see attached image for conceptual sample.

    Thanks!

    #28088

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    the hook to do that is documented here (one of the few so far…)

    http://docs.wpgeodirectory.com/geodir_social_sharing_buttons_html/

    The edit to the code to output the featured image is minimal.

    The code below if added to your theme functions.php will result in the image attached.

    
    
    /**
     * Wraps the sharing buttons div in our custom container
     *
     * @param string $content_html The HTML of the sharing buttons div
     * @return string Filtered HTML.
     */
    function my_theme_geodir_social_sharing_buttons_html( $content_html ) {
    	global $post; 
    	$thumb = the_post_thumbnail( 'medium' );
    
       return "<div class='my-theme-class'>".$thumb."</div>".$content_html;
    
    }
    add_filter( 'geodir_social_sharing_buttons_html', 'my_theme_geodir_social_sharing_buttons_html', 10, 1 );
    

    Now you just need to style css according to your needs.

    Thx

    #54207

    Brigitte
    Expired Member
    Post count: 235

    Hello paolo,

    Thank you for this function, it works well, and the featured image is displayed on the sidebar.

    But the function has a small problem. I want to disable sharing on social networks.

    If I disable the option (Design => Detail settings => Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar), the featured image disappears. It reappears if I re-activate the option.

    Is this a bug?

    Thanks in advance.

    #54218

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    no that is not a bug, that function hooks into the social sharing html (geodir_social_sharing_buttons_html). If you remove the social sharing you remove everything hooked into it’s html.

    You’ll need to use a different hook, depending on what you have hidden on that sidebar.

    You could try geodir_post_sidebar_html, however that could mess up the sidebar style if you don’t do it correctly.

    Let us know how you went.

    Thanks

    #54355

    Brigitte
    Expired Member
    Post count: 235

    Hello paolo,

    Sorry, I admit that this is a silly question … It’s totally logical!
    Thanks for reply, I will try with another hook.

    #65492

    Tony
    Expired Member
    Post count: 147

    paolo this is perfect! Now can we just hide the feature image from the gallery not that it’s in the sidebar? Just want to say like if image is feature don’t show in gallery.

    #65544

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    that is not possible, I’m sorry.

    Thanks

Viewing 7 posts - 1 through 7 (of 7 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