Autor avatar

This topic contains 16 replies, has 3 voices, and was last updated by  Giri 7 years, 2 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #395309

    Elena Samarkina
    Expired Member
    Post count: 12

    Hi, is there an opportunity to post Author Avatar here?
    I must change listing view.php?

    #395353

    Elena Samarkina
    Expired Member
    Post count: 12

    It’s possible ?

    #395368

    Paolo
    Site Admin
    Post count: 31206

    Hi Elena,

    no need to bump threads, we read them all and we guarantee and answer within 24 hours. https://wpgeodirectory.com/support-policy/

    I believe that can be done with a code snippet using hooks, a developer will let you know asap.

    Thanks for your patience,

    #395370

    Giri
    Expired Member
    Post count: 3155

    Hi Elena,

    You should use a custom snippet like this.

    
    
    add_action('geodir_after_listing_post_title', 'avatar_geodir_after_listing_post_title');
    function avatar_geodir_after_listing_post_title($view, $post) {
    	$author_id = $post->post_author;
    	echo get_avatar( $author_id, 60 );
    }

    Install this plugin, add the above snippet and then make sure to activate the snippet.

    https://wordpress.org/plugins/code-snippets/

    Let me know how that goes.

    Thanks

    PS: you may have to add soke custom css to style that part.

    #395371

    Elena Samarkina
    Expired Member
    Post count: 12

    Yes its work , but i have only avatar img without link , can I do the link for author page ?

    #395372

    Elena Samarkina
    Expired Member
    Post count: 12

    Just as it was done on listing detail page

    #395373

    Giri
    Expired Member
    Post count: 3155
    
    
    add_action('geodir_after_listing_post_title', 'avatar_geodir_after_listing_post_title');
    function avatar_geodir_after_listing_post_title($view, $post) {
    	$author_id = $post->post_author;
            $author_link = get_author_posts_url($author_id);
    	$entry_author = get_avatar( $author_id, 60 );
            printf('<div class="author-avatar"><a href="%s">%s</a></div>', esc_url($author_link), $entry_author);
    }
    #395377

    Elena Samarkina
    Expired Member
    Post count: 12

    Link don’t work

    #395382

    Paolo
    Site Admin
    Post count: 31206

    Giri took off for the night, but he’ll get back to you tomorrow morning 1st thing.

    Thanks for your patience.

    #395480

    Giri
    Expired Member
    Post count: 3155

    Hi Elena,

    I’m not sure what you mean link don’t work. You mean there is no link or pointing to incorrect page?

    Its better if you give me the page url where i can see that avatar in a private reply.

    Thanks

    #395483

    Elena Samarkina
    Expired Member
    Post count: 12

    I put this shippet , but all i can see- is author avatar without image and without link for author page

    #395484

    Giri
    Expired Member
    Post count: 3155

    Hi Elena, Did you replace my old snippet with the new one or you use both snippets?

    #395485

    Giri
    Expired Member
    Post count: 3155

    Hi Elena,

    You can try this code if the previous doesn’t work.

    
    
    add_action('geodir_after_listing_post_title', 'avatar_geodir_after_listing_post_title');
    function avatar_geodir_after_listing_post_title($view, $post) {
    	$author_id = $post->post_author;
    	$author_link = get_author_posts_url($author_id);
    	$entry_author = get_avatar( $author_id, 60 );
    	echo sprintf('<div class="author-avatar"><a href="%s">%s</a></div>', esc_url($author_link), $entry_author);
    }

    But i cannot give you more assistance without looking at your page.

    #395495

    Elena Samarkina
    Expired Member
    Post count: 12
    This reply has been marked as private.
    #395496

    Giri
    Expired Member
    Post count: 3155

    Not sure how that works. The $user_id variable coming from out of nowhere.

    But if it works for you then its fine.

    Thanks for letting me know.

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