How many members have made comments approved for an article?

Your PHP is wrong but what you are doing looks like it should work. $count = $wpdb->get_var( ‘SELECT COUNT(distinct comment_author) FROM ‘ .$wpdb->comments. ‘ WHERE comment_approved = 1 AND comment_post_ID = ‘.$post->ID ); echo $count; Precisely, you were trying to use a variable inside single quotes, which doesn’t work. Variables don’t expand inside single quotes. … Read more

static landing page leading to author specific pages w/ “live” content

As i see your code in header.php and index.php looking messy (because of many if conditions). If i’m understanding your problem then i do it like this create separate author.php for both authors their name like author-cait.php and author-shannons.php Give link like http://www.yousite.com/author/cait/ to button on static landing page.When user click on this,it takes him … Read more

Remove author bio from posts of a specific author

In my theme with raw codes, Post Meta Data are shown like: <div class=”entry-meta”> <span class=”meta-prep meta-prep-author”><?php _e(‘By ‘, ‘your-theme’); ?></span> <span class=”author vcard”><a class=”url fn n” href=”https://wordpress.stackexchange.com/questions/110649/<?php echo get_author_posts_url( false, $authordata->ID, $authordata->user_nicename ); ?>” title=”<?php printf( __( ‘View all posts by %s’, ‘your-theme’ ), $authordata->display_name ); ?>”><?php the_author(); ?></a></span> </div><!– .entry-meta –> It displays … Read more

Different posttypes for different authors

You don’t say how you have set up the different adsense. I will assume that in your template there is a folder, called ‘authors-ads’, in it you have some php files, named after your authors ids, e.g.: /authors-ads/author-1.php /authors-ads/author-12.php and so on. after that in your single.php or whatever template you use to display posts … Read more

How can I display other user avatars on an author profile page?

Have you tried to specify the $userID parameter of get_the_author_meta(), like shown below: echo get_avatar(get_the_author_meta( ‘ID’, $post->post_author ), 150); This uses the post_author key from your secondary query, which has the ID as value, that said you should be able to shorten your code to: echo get_avatar( $post->post_author, 150);

This code won’t find authors page?

Building URLs to WP resources in this fashion is fragile and shouldn’t be done. You should use appropriate API function to generate the links, in this case probably get_author_posts_url().

Posts in loop all show the same author when there are many authors

You need to move the bulk of your code into the loop proper. This part: $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); $ids[]= $post->ID; endwhile; } When the_post() executes, it populates the $post global upon which a number of template functions depend. The problem is that you are running your … Read more

Display A list of Admins

Use get_users function it allows you to query user by role. For contributors, $contributors = get_users(‘role=contributors’); foreach($contributors as $contributors){ // do something with contributors } For Admins, $admins = get_users(‘role=admin’); foreach($admins as $admins){ // do something with admins } replace role=* with your desired roles.

Display an authors post on a single page only when they are logged in

Check if a user is logged in using is_logged_in. If a user is logged in modify the query using pre_get_posts filtering posts by the current author ID. if ( is_user_logged_in() ) : function filter_posts_by_author( $query ) { global $current_user; get_currentuserinfo(); $query->set( ‘author’, $current_user->ID ); } add_action( ‘pre_get_posts’, ‘filter_posts_by_author’ ); // … loop else : echo … Read more

Display author’s name and avatar in post’s sidebar

Display author’s avatar and name in single page sidebar. Add this code in sidebar.php or single.php if ( is_singular( ‘post’ ) ) { echo get_avatar( get_the_author_meta( ‘user_email’ ), 75 ); echo get_the_author_meta( ‘display_name’ ); } Here 75 number is the avatar size. I hope it will help you.

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