0

I have the following code:

/*Get number of entries*/
    function get_entries_num( $id ) {
        $count=  count_user_posts( $id );
        if ($count == 1) 
        {
            return sprintf(__('%s total post','upme'), $post, $count);
        } else 
        {
            return sprintf(__('%s total posts','upme'), $count);
        }
    }

I want to link "%s total posts" this location get_author_posts_url($author_id).

So, I want to display WordPress user all post(author page) when someone click on "%s total posts".

1

Have you tried something like:

/*Get number of entries*/
function get_entries_num( $id ) {
    $count=  count_user_posts( $id );
    if ($count == 1) 
    {
        return '<a href="'.get_author_posts_url($id).'">'.sprintf(__('%s total post','upme'), $count).'</a>';
    } else 
    {
        return '<a href="'.get_author_posts_url($id).'">'.sprintf(__('%s total posts','upme'), $count).'</a>';
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.