Improving Co-Authors Plus Plugin [closed]
Happy to take this question in the WordPress.org forums 🙂
Happy to take this question in the WordPress.org forums 🙂
$author = $wp_query->post->post_author; $author = get_user_by(‘id’, $author); author->user_nicename; That should get you the author slug which you can use in your conditional statement. get_the_author can only be used inside the loop.
Unless those authors register (or created a user card by admin) and log in in order to submit a post they are not users Also… (in case they are logged in) the form must record the current user and add that to the data being submitted… Additional information would require you to share with us … Read more
You can access the posts author (inside the loop) with the global $post; echo $post->post_author If your sidebar comes after your main content (in code), then you could populate a global array (not the best solution, but ok). // in the loop: Add each author to the global $post_authors array $post_authors[] = $GLOBALS[‘post’]->post_author; // in … Read more
The user_nicename should never have spaces. It is a sanitized version of user_name, that has been sanitized (Aa-Zz,0-9,_,-) to be suitable for use as a slug. If you have spaces in your user_nicename values, you’re going to get 404 errors. To correct, you’ll probably need to edit the database directly. Here are instructions, with screenshots, … Read more
The get_posts() function retrieves posts from the database. If I understand you correctly, that’s not what you want though, you simply mean to check the author of the post currently displayed. You can simply use $post->post_author. If outside the Loop, you have to call upon the $post global first. Hence global $post; // only required … Read more
I guess you need administrator permissions to change the authors or modify the user role permissions. WordPress allows changing the post author only to a super-admin or a user with the right to edit others posts. Also, an editor only has these permissions
What you need here is to shuffle all the array elements & then display them. But since php’s shuffle() function doesn’t preserve array key associations, here’s a version that does. function shuffle_assoc(&$array) { $keys = array_keys($array); shuffle($keys); foreach($keys as $key) { $new[(string)$key] = $array[$key]; } $array = $new; return true; } Add this function somewhere … Read more
Your question is not very detailed or very clear but get_user_meta will return all of the user metadata for a user. That should have all of your fields. You could also use get_users for the second tab. I am not dealing with the first since you state that your “have no idea how to do … Read more
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>’; } }