Allow a subscriber to be an author and view only his post

You must write a small plugin for the Hook pre_get_posts; an example: add_action( ‘pre_get_posts’, ‘fb_allow_draft’ ); function fb_allow_draft( $query_obj ) { // only on admin screen use this filter if( ! is_admin() ) return; // change our query object to include any post status $query_obj->query_vars[‘post_status’] = ‘any’; } If you will specific this new loop … Read more

Showing posts for today and future

Use get_posts function with WP_Query params instead of get_children. The code will than look like this: $today = getdate(); $pages = get_posts( array( ‘post_status’ => array( ‘publish’, ‘future’ ), ‘post_type’ => ‘event’, ‘sort_order’ => ‘ASC’, ‘orderby’ => ‘date’, ‘year’ => $today[“year”], ‘monthnum’ => $today[“mon”], ‘day’ => $today[“mday”] ) ); foreach ( $pages as $post ) … Read more

Display amount of pending posts in back/front end

Easy native SQL query: global $wpdb; $sql = <<<SQL SELECT post_status, COUNT( * ) AS count FROM {$wpdb->posts} WHERE post_status=”pending” SQL; $result = $wpdb->get_results( $sql ); The result will be something like + ———– + —– + | post_status | count | + ———– + —– + | pending | 158 | + ———– + … Read more