function customize_output($results, $arg, $id, $getdata) { // The Query $apiclass = new uwpqsfprocess(); $query = new WP_Query($arg); ob_start(); $result = ''; // The Loop if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); global $post; $type = get_post_type(); if (get_post_meta(get_the_ID(), '_post_extra_boxes_checkbox', true) != 'on') { blokmaker(4, $type); } } echo $apiclass->ajax_pagination($arg['paged'], $query->max_num_pages, 4, $id, $getdata); } else { echo '<div class="col-md-12"><h2 style="margin-top:0;">Nothing found</h2></div>'; } /* Restore original Post Data */ wp_reset_postdata(); $results = ob_get_clean(); return $results; }
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); static $counters = array(); /* Our variables from the widget settings. */ $columns = $instance['columns']; $type = $instance['type']; $type2 = $type; if ($type == 'news') { $type2 = 'post'; } if (!isset($counters[$type2])) { $counters[$type2] = 0; } /* Before widget (defined by themes). */ //echo $before_widget; //rsr update gedoe if ($columns == 4) { $amount = 12; } elseif ($columns == 2) { $amount = 6; } elseif ($columns == 3) { $amount = 9; } else { $amount = 3; } if ($type == 'project') { $c = $counters[$type2]; $date_format = get_option('date_format'); $data = do_shortcode('[data_feed name="rsr"]'); $data = json_decode(str_replace('"', '"', $data)); $objects = $data->objects; $title = $objects[$c]->title; $text = $objects[$c]->text; $date = date($date_format, strtotime($objects[$c]->time)); $thumb = 'http://rsr.akvo.org' . $objects[$c]->photo; $link = 'http://rsr.akvo.org' . $objects[$c]->absolute_url; $type = 'RSR update'; blokmaker_rsr($amount, $type, $title, $text, $date, $thumb, $link); } else { $qargs = array('post_type' => $type2, 'posts_per_page' => 1, 'offset' => $counters[$type2]); $query = new WP_Query($qargs); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); blokmaker($amount, $type2); } wp_reset_postdata(); } } $counters[$type2]++; /* After widget (defined by themes). */ //echo $after_widget; }
<?php $type = get_post_type(); if ($type == 'post') { $type = 'news'; } blokmaker(4, $type);
</article> </div> <?php } ?> <?php if (!empty($attached)) { ?> <div class="col-md-3"> <div class="related"> <h2 class="head">Related posts</h2> <div class="row"> <?php $the_query = new WP_Query(array('post__in' => $attached, 'post_type' => 'any')); if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); $type = get_post_type(); if ($type == 'post') { $type = 'news'; } blokmaker(12, $type); } wp_reset_postdata(); } ?> </div> </div> <?php }
<?php $type = get_post_type(); if ($type == 'post') { $type = 'news'; } blokmaker(3, $type);