show author image in posts

I know this is old, but I just came across it shortly before I came across the solution. To display the author image inside the loop, just use this code: <?php echo get_avatar( get_the_author_meta( ‘ID’ ) , 32 ); ?> Where ’32’ is the size of the image. If it’s outside the loop, then just … Read more

Display edit link if post author is current user

If you just have to modify the author.php page, this piece of code will probably work : <?php if( is_user_logged_in() && is_author(get_current_user_id()) ) { edit_post_link(‘edit’, ”, ”); } ?> The first part of the conditions checks if there is a user logged. The second one will be true if the current page is the author … Read more

Display posts with author in the url with custom post types

You can use the %author% tag in the rewrite property in register_post_type(). However, although the rewrite rules are added (after they’re flushed) – WordPress doesn’t replace the tag with its appropriate value when generating the permalink of your post type. For instance you end up with the permalink www.example.com/%author%/gallery-name The following replaces %author% with the … Read more

Check If comment author is registered

I wonder if you mean this kind of check: if( $comment->user_id > 0 ) { // Registered comment author } in your comment’s template callback. This is determined in the the wp-comments-post.php file: $commentdata = compact(‘comment_post_ID’, …, ‘user_ID’ ); $comment_id = wp_new_comment( $commentdata ); but it’s not obvious where the user_ID variable comes from, since … Read more

Display Authors Comments on Profile Page

What you need to use here is the WP_Comment_Query() function. So on the author.php page, you can easily get the author info and ID as followed: // get author info $curauth = (isset($_GET[‘author_name’])) ? get_user_by(‘slug’, $author_name) : get_userdata(intval($author)); // set ID $user_id = $curauth->ID; Then we add the user ID in the query arguments array: … Read more