', $popup_user_width, $popup_user_percent, $popup_display_end, $popup_user_manual_show, $popup_user_notshow_onclose, $popup_user_notshow_onclose_all, get_the_ID(), $popup_trigger_oncomment, $popup_display_exit, $popup_window_popafter); $output .= ''; $output .= '
'; if ($popup_window_popafter != '') { $output .= ''; } $output .= ''; $output .= ""; $output .= ''; return $output; } public static function leading_posts_from_analytics_for7days() { global $wpdb; $table_name = $wpdb->prefix . ESSB3_TRACKER_TABLE; $toDate = date ( "Y-m-d" ); $fromDate = date ( "Y-m-d", strtotime ( date ( "Y-m-d", strtotime ( date ( "Y-m-d" ) ) ) . "-8 days" ) ); $query = ""; //foreach($essb_networks as $k => $v) { $query .= "SELECT essb_post_id, COUNT( essb_post_id ) AS cnt"; $query .= ' FROM '.$table_name .' WHERE essb_date BETWEEN "'.$fromDate.'" AND "'.$toDate.'" GROUP BY essb_post_id ORDER BY cnt DESC'; $post_stats = $wpdb->get_results ( $query ); $limit = 3; $cnt = 0; $result_posts = array(); if (isset($post_stats)) { foreach ( $post_stats as $rec ) { $post_permalink = get_permalink($rec->essb_post_id); $post_title = get_the_title($rec->essb_post_id); $post_excerpt = essb_core_helper_get_excerpt_by_id($rec->essb_post_id); $post_image = has_post_thumbnail( $rec->essb_post_id ) ? wp_get_attachment_image_src( get_post_thumbnail_id( $rec->essb_post_id ), 'single-post-thumbnail' ) : ''; $image = ($post_image != '') ? $post_image[0] : ''; $cnt++; $result_posts[] = array("title" => $post_title, "url" => $post_permalink, "excerpt" => $post_excerpt, "image" => $image); if ($limit < $cnt) { break; } } } return $result_posts; } public static function prepare_leadingposts_html($posts_data) { $output = ""; foreach ($posts_data as $post_object) { $output .= ' '; } return $output; } }