show list of latest comments for each post in a loop

You should place your code inside the loop and add to the args array ‘post_id’ => get_the_ID() so it should look like this: while(have_posts()){ the_post(); //your post loop output $args = array( ‘status’ => ‘approved’, ‘number’ => ‘5’, ‘post_id’ => get_the_ID() ); $comments = get_comments($args); foreach($comments as $comment) : echo( $comment->get_avatar . $comment->comment_author . ‘<br … Read more

How to set the default avatar of buddypress avatar [closed]

As @shanebp said: You can define the default avatar site-wide by using BP_AVATAR_DEFAULT For this you can define the constant(s) BP_AVATAR_DEFAULT and/or BP_AVATAR_DEFAULT_THUMB inside the bp-custom.php as described at the buddypress codex page Customizing BuddyPress Avatars, for example like this: Code: $upload_dir = wp_upload_dir(); $url_default_avatar = $upload_dir[‘baseurl’] . ‘/defaults/buddypress/default-member-avatar.png’; $url_default_avatar_thumb = $upload_dir[‘baseurl’] . ‘/defaults/buddypress/default-member-avatar-thumb.png’; define … Read more

Change the “Default Avatar” admin option via functions.php

You can just update the option field avatar_default to your new image url: add_filter( ‘avatar_defaults’, ‘mytheme_default_avatar’ ); function mytheme_default_avatar( $avatar_defaults ) { $avatar = get_option(‘avatar_default’); $new_avatar_url = get_template_directory_uri() . ‘/images/default_avatar.png’; if( $avatar != $new_avatar_url ) { update_option( ‘avatar_default’, $new_avatar_url ); } $avatar_defaults[ $new_avatar_url ] = ‘Default Avatar’; return $avatar_defaults; }

Get avatar of the logged-in user in WordPress

All you need to do is pass the current users email address into the get_avatar() function. <?php $current_user = wp_get_current_user(); if ( ($current_user instanceof WP_User) ) { echo get_avatar( $current_user->user_email, 32 ); } ?> Here are some links for specifics: get_avatar(); wp_get_current_user(); A response to your new problem in the comments below: <?php echo ‘<img … Read more

Which Function Displays The Post Authors Gravatar

Notice: get_the_author_ID is deprecated since version 2.8! Use get_the_author_meta(‘ID’) instead. in C:\Users\Administrator\Desktop\www.wpsites.dev\wp-includes\functions.php on line 2908 You aren’t using get_the_author_meta(‘ID’); as instructed by the Notice. You are just using get_the_author_meta(). The latter returns an empty string when I try it. Reference http://codex.wordpress.org/Function_Reference/get_the_author_meta

How to get authors avatar

The function you’re looking for is get_avatar – you should put in something like this: <?php echo get_avatar( get_the_author_meta( ‘ID’ )); ?>

Remove hovercard for only certian gravatars

Since @toscho has seemed to have revived this question here is one way to do it (not saying it’s the best but it works) It’s important to note I’ve switched to Jetpack which has hovercards built in. If you are using Jetpack here’s how you do it. function nifty_remove_grofiles() { if(is_page(‘about’)){ remove_action( ‘wp_enqueue_scripts’, ‘grofiles_attach_cards’ ); … Read more

Conditional avatar

A few months ago I wrote a discussion over at this WordPress.org thread regarding this. Check it out: http://wordpress.org/support/topic/custom-avatar-4?replies=5 Here is the code you’ll need in the template you want your avatars: <?php $uploads = wp_upload_dir(); //WordPress upload path $uploads_url = ( $uploads[‘baseurl’] ); //full url of upload dir $uploads_dir = ( $uploads[‘basedir’] ); //full … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)