Tag Info

New answers tagged

0

You can register a function in your functions.php like that: function get_user_role($id) { $user = new WP_User($id); return array_shift($user->roles); } Then in template file you call the function: <?php $aid = get_the_author_meta('ID'); echo get_user_role($aid); ?>


0

Yes, content is not showing in editor. And there is no content in any of template files as well. Actually Website pages are already built by someone, and I want to edit some pages content. I am site Administrator and have Administrator rights. Some pages have been built by administrator and I can edit content of these pages successfully. But some pages ...


1

As often the case, asking the question reveals the answer: Use global $authordata;. Fix php errors: == operator. Fix $rid='445', not $rid=445. Here's the working code: add_action ('genesis_before_sidebar_widget_area','user_testimonials',10); function user_testimonials(){ if (is_author() || is_singular('post')){ global $authordata; //using global ...


0

So, the content is not showing in the WSIWYG editor? if thats true, is the content in any of the template files?


7

There is no special hook to author change. But you can achieve it by using post_updated hook. Example: add_action('post_updated', 'prefix_on_update_author', 10, 3); function prefix_on_update_author($post_ID, $post_after, $post_before) { if ($post_after->post_author != $post_before->post_author) { // author has been changed // ...


0

The easiest way would be using get_post_field(): $post_author = get_post_field( 'post_author', $post_id ); For more details on this issue: have a look at this StackOverflow answer.


1

Use pre_get_posts to modify author archive queries- function wpd_author_archive( $query ){ if ( $query->is_author() && $query->is_main_query() ){ $query->set( 'post_type', array( 'post', 'product' ) ); } } add_action( 'pre_get_posts', 'wpd_author_archive' );


1

Give this a try 1) First add new headers for the plugin meta: add_filter('extra_plugin_headers', 'add_extra_headers'); function add_extra_headers(){ return array('Author2'); } 2) Next filter the authors meta row on output: add_filter('plugin_row_meta', 'filter_authors_row_meta', 1, 4); function filter_authors_row_meta($plugin_meta, $plugin_file, ...


0

SlimStat is a plugin that will do just what you want with almost no config required. I worked perfect for me. Now my authors can login and they see only what i want them to see and all the stats for their posts/content plus all the other great demographic type info. I'm very lucky to have found it. so far it works great for me!



Top 50 recent answers are included