Changeset 1709761
- Timestamp:
- 08/07/2017 06:43:47 PM (9 years ago)
- File:
-
- 1 edited
-
monetize-me/trunk/main.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
monetize-me/trunk/main.php
r1709597 r1709761 93 93 $width = intval($atts['width']); 94 94 $stype = msbd_sanitization($atts['stype']); 95 $limit = (intval($atts['limit']) > 0) ? intval($atts['limit']) : 1; 95 96 96 97 if ($width<1) { … … 113 114 ), 114 115 115 'posts_per_page' => intval( $ atts['limit']),116 'posts_per_page' => intval( $limit ), 116 117 'orderby' => 'rand', 117 118 ); … … 153 154 //print_r($args); 154 155 //exit; 156 157 158 ob_start(); 159 155 160 $ads = new WP_Query( $args ); 156 161 157 ob_start(); 158 if( $ads->have_posts()) { 162 $servable_ads = array(); 163 $servable_ad_count = 0; 164 165 if ($ads->have_posts()) { 159 166 while( $ads->have_posts()) { 160 167 $ads->the_post(); 161 if ($atts['wrapper']==1) { 162 echo '<div class="ads-section'.msbd_asf($atts['class']).'">'.get_the_content().'</div>'; 163 } else { 164 echo get_the_content(); 165 } 168 169 $servable_ad_count++; 170 $servable_ads[] = get_the_content(); 166 171 167 172 $count_view = intval( get_post_meta(get_the_ID(), 'mmp_count_view', true) ); 168 173 $count_view++; 169 174 update_post_meta(get_the_ID(), 'mmp_count_view', $count_view); 175 176 if ($servable_ad_count>=$limit) { 177 break; 178 } 170 179 } 180 181 for ($x = $servable_ad_count; $x<$limit; $x++) { 182 $servable_ad = $servable_ads[0]; 183 $servable_ads[] = $servable_ad; 184 } 185 } 186 187 if ($atts['wrapper']==1) { 188 echo '<div class="ads-section'.msbd_asf($atts['class']).'">'.implode("", $servable_ads).'</div>'; 189 } else { 190 echo implode("", $servable_ads); 171 191 } 172 192 … … 174 194 175 195 return ob_get_clean(); 196 176 197 } 177 198 } // End of Class Main
Note: See TracChangeset
for help on using the changeset viewer.