d6;'; $styles['style_02']['links'] = 'color:#ffffff;'; // Inspired by Facebook $styles['style_03']['wrapper'] = 'padding:15px;background:#3a589e;'; $styles['style_03']['links'] = 'color:#ffffff;'; // Inspired by Google Plus $styles['style_04']['wrapper'] = 'padding:15px;background:#df4b37;'; $styles['style_04']['links'] = 'color:#ffffff;'; // Inspired by LinkedIn $styles['style_05']['wrapper'] = 'padding:15px;background:#0d77b7;'; $styles['style_05']['links'] = 'color:#ffffff;'; // Inspired by Pinterest $styles['style_06']['wrapper'] = 'padding:15px;background:#cd2029;'; $styles['style_06']['links'] = 'color:#ffffff;'; // Don't Stop Believin' $styles['style_07']['wrapper'] = 'padding:15px;background:#333333;'; $styles['style_07']['links'] = 'color:#ffffff;'; // Thunderstruck $styles['style_08']['wrapper'] = 'padding:15px;background:#30394F;'; $styles['style_08']['links'] = 'color:#ffffff;'; // Livin' On A Prayer $styles['style_09']['wrapper'] = 'padding:15px;background:#EEEEEE;'; $styles['style_09']['links'] = 'color:#30394F;'; // Custom $styles['custom']['wrapper'] = 'padding:15px;background:' . $custom_bg . ';'; $styles['custom']['links'] = 'color:' . $custom_link . ';'; /** * BUILD OUT THE WIDGET */ // Output the "Before Widget" content if ( isset( $args['before_widget'] ) ) : echo wp_kses_post( $args['before_widget'] ); endif; // Begin output of the widget html echo '
'; // Check if title is set if ( $title ) : // Output the "Before Title" content if ( isset( $args['before_title'] ) ) : echo wp_kses_post( $args['before_title'] ); endif; echo '' . esc_html( $title ) . ''; // Output the "After Title" content if ( isset( $args['after_title'] ) ) : echo wp_kses_post( $args['after_title'] ); endif; endif; $swp_args = array( 'posts_per_page' => $count, 'post_type' => $post_type, 'meta_key' => '_' . $network, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key 'orderby' => 'meta_value_num', 'order' => 'DESC', 'cache_results' => false, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'ignore_sticky_posts' => 1, ); if ( 0 !== $timeframe ) { $swp_args['date_query'] = array( 'column' => 'post_date', 'after' => '- ' . $timeframe . ' days', ); } // Reset the main query wp_reset_postdata(); // Query and fetch the posts $swq = new WP_Query( $swp_args ); // Begin the loop if ( $swq->have_posts() ) : $i = 1; while ( $swq->have_posts() ) : if ( $i <= $count ) : $swq->the_post(); // If we are supposed to show count numbers.... if ( 'true' === $show_count ) : $post_id = get_the_ID(); $shares = get_post_meta( $post_id, '_' . $network, true ); $share_html = '' . esc_html( SWP_Utility::kilomega( $shares ) ) . ' ' . esc_html( $count_label ) . ''; else : $share_html = ''; endif; // If we are supposed to show thumbnails if ( 'true' === $thumbnails && has_post_thumbnail() ) : $thumbnail_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'thumbnail' ); $thumbnail_html = ''; if ( 'custom' === $thumb_size ) : $thumb_width = preg_replace( '/[^0-9]/', '', $thumb_width ); $thumb_height = preg_replace( '/[^0-9]/', '', $thumb_height ); $thumbnail_html .= '' . esc_attr( str_replace( ''; else : $thumbnail_html .= '' . esc_attr( str_replace( ''; endif; $thumbnail_html .= ''; // If we are not supposed to show thumbnails else : $thumbnail_html = ''; endif; // Generate the HTML for a link $link_html = '' . esc_html( get_the_title() ) . '' . $share_html . ''; // Output the post to the site echo '
' . wp_kses_post( $thumbnail_html ) . '' . wp_kses_post( $link_html ) . '
'; echo '
'; endif; // End the loop endwhile; endif; // Reset the main query so as not to interfere with other queries on the same page wp_reset_postdata(); echo '
'; // Output the "After Widget" content if ( isset( $args['after_widget'] ) ) : echo wp_kses_post( $args['after_widget'] ); endif; } }