Support » Plugin: WPAdverts - Classifieds Plugin » replace the username on Ad details page with link

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Greg Winiarski


    Hi, WPAdverts has a adverts_tpl_single_posted_by filter which allows replacing the user name on Ad details page, if you just want to convert it to a URL then the code below will do that

    add_filter("adverts_tpl_single_posted_by", "my_adverts_tpl_single_posted_by", 10, 2 );
    function my_adverts_tpl_single_posted_by( $posted, $post_id ) {
        $post = get_post( $post_id );
        $author_url = get_author_posts_url( $post->post_author );
        $author_name = get_post_meta($post_id, 'adverts_person', true);
        return sprintf( __('by <a href="%s">%s</a>', "adverts"), $author_url, $author_name );

    The code you can add in your theme functions.php file.

    Hey, Greg! Thank’s for your answer! But there is only one problem – now the link displays specifically some other users name instead of the seller’s name (???)

    Example: Someone named Jonh signs up in Peepso and then go to WPAdverts to post some ad.
    Once published, in Ad details page, the name displayed is not Jonh, but the name of some other guy. Besides that, the link doesn’t lead you to that user profile. The url displayed is when the correct url should be https://mysitename/profile/?jonh/

    Any tips on why this is happening?

    If you want to test it by yourself, please try to post some Ad in

    You will see that the displayed name is not your name, but the name of some other guy. And when you click on it, you will not be redirected to any profile at all.

    Update: The wrong name display bug is now fixed (I really don’t know why, I just deleted the code and pasted it again). But the link do not redirect the user to the sellers profile yet.

    Plugin Author Greg Winiarski


    Please check with PeepSo support what function you can use to get the URL to author profile, once you will know that you will need to update this line

    $author_url = get_author_posts_url( $post->post_author );

    or just ask them how to change the line above to return author profile URL to $author_url variable.

    Thank you, Greg! I’ll will show this topic to their staff to see what they can do about it 😉


    PeepSo has an option in configuration->appearance called “always link to PeepSo profiles”.

    It hooks into author_link filter, and when enabled it should work perfectly fine with WPAds, since Greg uses a get_author_posts_url which passes through that filter.

    It worked just fine, thank you all! You people are amazing! 😀 😀 😀

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘replace the username on Ad details page with link’ is closed to new replies.