Get the author of the latest revision
Try the_modified_author() or get_the_modified_author(), this should give you the display name of the last user that modified the post.
Try the_modified_author() or get_the_modified_author(), this should give you the display name of the last user that modified the post.
The original author isn’t quite right in saying “which is merely the more elegant way to write”. set_query_var() will always override the main query, whereas if you actually use: $wp_query->set( ‘category__not_in’, $excluded ); … it will work for any instance of query_posts(), such as the recent posts widget.
You can check if current user is an Author (WP-Codex) $current_user_is_allowed_to_edit = false; if ( current_user_can(‘delete_posts’) ) { $current_user_is_allowed_to_edit = true; } And use it in the if-statement at the point where you implement the Live Edit function. Here is the whole code (for user roles): http://pastebin.com/fY7UPcB1 EDIT: Here is the new code (check for … Read more
To print just the total number of comments for a given post ID, use the count argument: echo get_comments( array ( // post ID ‘post_id’ => 149, // return just the total number ‘count’ => TRUE ) ); or just use // Argument: Post ID echo get_comment_count( 149 ); To get the total number of … Read more
As I already stated, straight from the codex exclude (string) Excludes one or more categories from the list generated by wp_list_categories. This parameter takes a comma-separated list of categories by unique ID, in ascending order As you have stated, you have to use the category slug. To make this possible and dynamic, I think the … Read more
Personally, I’d generate the date in php using the PHP Date class and then $date->sub(). With a few more lines of code the query will read: … WHERE post_date >= “.$date.” …
I had same problem. According to documentation: The hierarchy for a custom taxonomy is listed below: taxonomy-{taxonomy}-{term}.php taxonomy-{taxonomy}.php taxonomy.php archive.php index.php So, it doesn’t matter witch template file you are using, all of them will generate same issue. When I put in the beginning of template file code var_dump($wp_query);, i found this: public ‘request’ => … Read more
If your things are laid properly, this code will output 10 posts from film CPT, where taxonomy is category-film and it will occur each of the term of that particular taxonomy. I’m not aware about your templating, so lay your layout accordingly. <?php $_terms = get_terms( array(‘category-film’) ); foreach ($_terms as $term) : $term_slug = … Read more
As you can see, I tried declaring the $post variable as global to account for failures due to being outside of the Loop. The problem is not that the post is “outside of the loop”, problem is that AJAX request is a completely separate HTTP request. When you do an AJAX request, is just like … Read more
You can use a custom loop to get all stick post and then return all normal post. You may have to modify this code a bit but here is how you can return all sticky post. You can play with the second custom loop for the individual pages and return just the one post. //is … Read more