function supernova_slider_postids() { global $supernova_options; $automate_slide = $supernova_options['automate-slides']; $post_ids = $automate_slide; $posts_per_page = 8; $offset = 0; /**STICKY POSTS**/ if ($automate_slide == 1) { $post_ids = supernova_get_sticky_postsids($posts_per_page, $offset, 'date'); } /**RECENT POSTS**/ if ($automate_slide == 2) { $post_ids = supernova_get_specific_post_ids($posts_per_page, $offset, 'date', NULL, NULL); } /**POPULAR POSTS**/ if ($automate_slide == 3) { //If Actual Count selected $post_ids = supernova_get_specific_post_ids($posts_per_page, $offset, 'meta_value_num', 'supernova_post_views_count', NULL); $total_posts = supernova_count_posts_by_metakey('supernova_post_views_count'); //Count on Comment if (empty($post_ids) || $supernova_options['poplular-pos-dep'] == '2') { $total_posts = supernova_count_posts_with_comments(); $post_ids = supernova_get_specific_post_ids($posts_per_page, $offset, 'comment_count', NULL, NULL); } //If user selected to choose himself if ($supernova_options['poplular-pos-dep'] == '3') { $total_posts = supernova_count_posts_by_metakey('supernova-popular-post', 1); $post_ids = supernova_get_specific_post_ids($posts_per_page, $offset, NULL, 'supernova-popular-post', 1); } //if nothing found if (empty($post_ids)) { $post_ids = supernova_get_specific_post_ids($posts_per_page, $offset, 'date', NULL, NULL); } } /*RECOMMENDED POSTS*/ if ($automate_slide == 4) { $post_ids = supernova_get_specific_post_ids($posts_per_page, $offset, NULL, 'supernova-recommended-post', 1); } return $post_ids; }
function supernova_tabber_posts($type, $posts_per_page, $show_thumb, $comment_date) { global $supernova_options, $post; $post_ids = array(); if (trim($type) == 1) { $post_ids = supernova_get_specific_post_ids($posts_per_page, 0, 'date', NULL, NULL); } if ($type == 2) { //If Actual Count selected $post_ids = supernova_get_specific_post_ids($posts_per_page, 0, 'meta_value_num', 'supernova_post_views_count', NULL); //Count on Comment if (empty($post_ids) || $supernova_options['poplular-pos-dep'] == '2') { $post_ids = supernova_get_specific_post_ids($posts_per_page, 0, 'comment_count', NULL, NULL); } //If user selected to choose himself if ($supernova_options['poplular-pos-dep'] == '3') { $post_ids = supernova_get_specific_post_ids($posts_per_page, 0, NULL, 'supernova-popular-post', 1); } } if ($type == 3) { $post_ids = supernova_get_specific_post_ids($posts_per_page, 0, NULL, 'supernova-recommended-post', 1); } if ($type == 4) { $post_ids = supernova_get_specific_post_ids($posts_per_page, 0, 'rand', NULL, NULL); } $post_content = get_posts(array('post__in' => $post_ids, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'orderby' => 'post__in')); if ($post_content) { echo '<ul class="supernova_tabber_widget_' . $type . '">'; foreach ($post_content as $post) { setup_postdata($post); $id = get_the_ID(); echo '<li>'; if (supernova_thumbnail_widget($id) && $show_thumb == 1) { echo '<span class="supernova_tabber_thumbnail">' . supernova_thumbnail_widget($id) . '</span>'; } echo '<h4>' . get_the_title($id) . '</h4>'; echo '<a class="tabber_link" href="' . get_permalink($id) . '">'; echo '</a>'; if ($comment_date != 3) { echo '<span class="tabber_comment">'; if ($comment_date == 2) { echo '<span>' . get_the_time(get_option('date_format'), $id) . '</span>'; } if ($comment_date == 1) { comments_popup_link(__('Leave A Comment', 'Supernova'), __('1 comment', 'Supernova'), ' % Comments'); } echo '</span>'; } echo '</li>'; } echo "</ul>"; } }