Add Post Author body class to WordPress

$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.

If statement for is_author of a post

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

How can I modify the header of RSS feed items?

this value comes from the template tag the_author(). You can also filter this. But it is important, that you check, that the filter only work on the feeds; see the follow example at the check for is_feed(). After this i change the autor name only, if the string has the value ‘name_xyz’; here is the … Read more

Extracting a variable from a permalink

You can get the queried author in author.php with get_queried_object(): $author = get_queried_object(); echo $author->ID; $author_data = get_object_vars( $author->data ); echo $author_data[‘display_name’]; echo $author_data[‘user_url’]; echo $author_data[‘user_email’];

Send email to admin with post author

Missing global ? global $post; No global variable available if you are using publish_post action hook! Ref : http://hungred.com/how-to/tutorial-post-id-publishpost-action-hook-wordpress/ Update 2 : or try this $author = get_userdata($post->post_author); So you can use $author where you will 😀

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