Echo author slug in post edit page
Found it: global $post; $author_id=$post->post_author; the_author_meta(‘user_nicename’, $author_id );
Found it: global $post; $author_id=$post->post_author; the_author_meta(‘user_nicename’, $author_id );
Basic debugging… $current_author = get_query_var(‘author’); var_dump($current_author); … would reveal that $current_author is a string, not an object. The problem is that you are trying to use the string as an object in the query. get_posts( ‘author=”.$current_author->id.”&posts_per_page=1&order=DESC&orderby=post_date’ ); Change $current_author->id to $current_author and the query works. $author_posts = get_posts( ‘author=”.$current_author.”&posts_per_page=1&order=DESC&orderby=post_date’ );
First you need to have a child theme. Add this to your style.css of your child theme .entry-meta .byline { display: none; } This should remove only the author from the post. Here’s a bit more information on customizing twenty fourteen theme in wordpress: http://techdwarf.com/customize-twenty-fourteen-theme-wordpress
Registering a custom post type has nothing to do with object oriented programming and classes. In the database, there is a column named post_type, some posts are of type post, some page, a custom post type is when you call register_post_type to tell WP how to handle a new value. But beyond that, there are … Read more
If you use WordPress author template to show user posts ( example.com/author/{user_name} ) the best solution will be to change the main query via the pre_get_posts filter hook. function se339534_author_any_post_types $query ) { // apply changes only for author archive page if ( ! is_author() || ! $query->is_main_query() ) return; $query->set(‘post_type’, ‘any’); } add_action( ‘pre_get_posts’, … Read more
Checkout User Roles and Capabilities Plugin
Do a WP_User_Query and then go through the results: $wp_user_search = new WP_User_Query( array( ‘role’ => ‘author’, ‘fields’ => ‘all_with_meta’ ) ); $editors = $wp_user_search->get_results(); echo ‘<pre>’; print_r( $editors ); echo ‘</pre>’;
I’d use Firebug in Firefox to see the CSS class used for the author name, then disable display. So, assuming that the css class was called ‘author_name’, I would put this in the styles.css of the child theme that I was using, or in the ‘extra CSS’ area of the theme settings (if available); .author_name … Read more
Try this plugin it’s the easy way of doing what you want co-authors-plus
Please update the code as below add_action( ‘admin_menu’, ‘remove_menus’ ); function remove_menus(){ $user = wp_get_current_user(); $role = ( array ) $user->roles; if($role[0]==subscriber) add_menu_page( ‘edit.php’ ); //dashboard }