List authors of site with link and gravatar

To answer your problems: Sorting by post count You can collect all the information you need in to an array and sort that array by number of posts , like this: //function to sort array by filed function authors_orderBy($data, $field){ $code = “if (\$a[‘$field’] == \$b[‘$field’]) {return 0;} return (\$a[‘$field’] < \$b[‘$field’]) ? 1 : … Read more

Change destination author link

To only edit the link associated with authors, in the functions.php of your theme: add_filter( ‘author_link’, ‘new_author_link’, 10, 1 ); function new_author_link( $link ) { $link = ‘http://newlink.com/’; //set this however you wish return $link; //after you’ve set $link, return it to the filter } If you’re looking to do something like set each author’s … Read more

Find most recent authors

Use a custom SQL query to grab the latest 16 post IDs with unique authors; $post_IDs = $wpdb->get_col( “SELECT ID FROM $wpdb->posts WHERE post_type=”product” AND post_status=”publish” GROUP BY post_author ORDER BY post_date DESC LIMIT 16″ ); Then start up a new query with the post__in argument; $recent_posts = new WP_Query( array( ‘post__in’ => $post_IDs, ‘post_type’ … Read more

How to make a relationship between books and authors?

To build relationships, I know of two plugins, both very well coded and maintained: Posts 2 Posts Efficient many-to-many connections between posts, pages, custom post types, users. Advanced Custom Fields – this one would need the add-on Users Select, but as the plugin is being completely rewritten and will change the add-on management, it would … Read more

More posts from the current author

This will retrieve the posts of current author when used in the loop. Put the following in your theme functions.php: function my_get_display_author_posts() { global $authordata, $post; $authors_posts = get_posts( array( ‘author’ => $authordata->ID, ‘post__not_in’ => array( $post->ID ) ) ); $output=”<ul>”; foreach ( $authors_posts as $authors_post ) { $output .= ‘<li><a href=”‘ . get_permalink( $authors_post->ID … Read more

Allow authors to post only in categories they create in WordPress

This little plugin shows the user role ‘author’ only its own categories & posts. So you can edit it for your own post-type and taxonomy. /* Plugin Name: Show own categories Description: This plugin shows the user role ‘author’ only its own categories & posts Version: 0.1 Author: Soren Wrede License: GPL2 License URI: https://www.gnu.org/licenses/gpl-2.0.html … Read more

Show Custom Post Type by Author

You will need to filter ‘author_link’ to conditionally add the parameter that can be used to add the custom post type into the query for the author’s posts. add_filter( ‘author_link’, ‘myprefix_author_link’, 10, 3 ); function myprefix_author_link( $link, $author_id, $author_nicename ) { if ( is_singular( ‘myCPT’ ) || is_post_type_archive( ‘myCPT’ ) ) { $link = add_query_arg( … Read more

Show the title of the latest post by author

You can get the latest post of an author adding the following code to your function: $latest_post = get_posts( array( ‘author’ => $id, ‘orderby’ => ‘date’, ‘numberposts’ => 1 )); // Since get_posts() returns an array, but we know we only // need one element, let’s just get the element we need. $latest_post = $latest_post[0]; … Read more

how to make author to write comment on only his own posts?

I have the same thing running on my website. Here is how I do do it… Only post author and commentor can view each others comments function restrict_comments( $comments , $post_id ){ global $post; $user = wp_get_current_user(); if($post->post_author == $user->ID){ return $comments; } foreach($comments as $comment){ if( $comment->user_id == $user->ID || $post->post_author == $comment->user_id ){ … Read more

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