Tag Info

New answers tagged

0

Use get_userdata() to retrieve all user data. The function accepts user ID. So the following code will give you the user url. <?php php $user_info = get_userdata(1); /* replace 1 with dynamic user id variable in your context*/ echo 'User url: ' . $user_info->user_url . "\n"; echo 'Users name: ' . $user_info->first_name . "\n"; ?>


3

Add the following code to your functions.php: function allow_contributor_uploads() { $contributor = get_role('contributor'); $contributor->add_cap('upload_files'); } if ( current_user_can('contributor') && !current_user_can('upload_files') ) { add_action('admin_init', 'allow_contributor_uploads'); } This will add the upload_files ...


0

To include custom post time in the $author_query array, add another key=>value element to $author_query array. Example: $author_query = array( 'posts_per_page' => '-1', 'author' => $current_user->ID, 'post_type'=>'your custom post type name' );


1

Run a couple of queries and a code snippet to calculate the word count for the post content, comments content and tag names on each post. // This query will return the number of words in the post content $post_qry="SELECT LENGTH(post_content) - LENGTH(REPLACE(post_content, ' ', ''))+1 from wp_posts where ID=".$post_id; // This query will return the number ...


1

Inside The Loop you can use the Template Tag the_author() to display or get_the_author() to return the same. For an introduction to outside the loop usage take a look at the Q&A's at the thread How to get Author ID outside the loop on here.


0

The property on the object for author is post_author. You can access it like this in the loop where $post is your WP_Post object. $author = $post->post_author; If you want to display it: echo $post->post_author;


0

FYI, Google has ended the authorship and image in SERPs program. Read https://support.google.com/webmasters/answer/6083347?hl=en



Top 50 recent answers are included