Display subscribed authors' posts on a specific page
-
Here’s my code:
global $wpdb; global $current_user; $table_name = $wpdb->prefix . "wpsa_subscribe_author"; get_currentuserinfo(); $post_author_id = $current_user->ID; $subscribers = $wpdb->get_results($wpdb->prepare("SELECT author_id FROM $table_name WHERE subscriber_id = %d AND status = %s", $post_author_id, 'active')); foreach ($subscribers as $subscriber) { $a = array($subscribers[0]->author_id); array_push($a, $subscriber->author_id); } $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; //$wp_query = new WP_Query(array('author__in' => $a, 'paged' => $paged)); $wp_query = new WP_Query(array( 'author__in' => $a, 'paged' => $paged, 'post_type' => array( 'post', 'comedy' ),) ); if (have_posts()) : while (have_posts()) : the_post(); ?>
Only two authors’ posts show up if I subscribe more than two authors.
Here’s my site: https://itransl.com/subscription/Can you tell me why?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Display subscribed authors' posts on a specific page’ is closed to new replies.