Show sidebar only to author of post

The reason this is not working is because you are trying to use undefined variables, they are declared outside the function and can therefor not be used without prefixing them with the global keyword. If you have error_reporting enabled you would see warnings like this: Notice: Undefined variable: current_user in /… on line 11 Notice: … Read more

Author post count in category

You don’t need to loop through the posts for this. Instead, just call the method get_posts() which will return an array of posts and then just count the number of posts in that array. $user_id = get_the_author_meta(‘ID’); $args = array( ‘author_name’ => $user_id, ‘category_name’ => ‘categoryname’, ); $wp_query = new WP_Query($args); $posts = $wp_query->get_posts(); $my_count … Read more

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