Current Path : /var/www/ooareogundevinitiative/wp-content/themes/pain/framework/shortcodes/donation/ |
Current File : /var/www/ooareogundevinitiative/wp-content/themes/pain/framework/shortcodes/donation/donation.php |
<?php function jwsthemes_donars_func($atts, $content = null) { extract(shortcode_atts(array( 'columns' => 4, 'el_class' => '', 'category' => '', 'posts_per_page' =>'-1', 'orderby' => 'none', 'order' => 'none', 'show_title' => 0, 'show_job' => 0, 'show_pagination' => 0, 'show_donated' => 0, ), $atts)); $class = array(); $class[] = 'jw-donaters-grid '; $class[] = $el_class; $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' ); $args = array( 'posts_per_page' => $posts_per_page, 'paged' => $paged, 'orderby' => $orderby, 'order' => $order, 'post_type' => 'donors', 'post_status' => 'publish'); if (isset($category) && $category != '') { $cats = explode(',', $category); $category = array(); foreach ((array) $cats as $cat) : $category[] = trim($cat); endforeach; $args['tax_query'] = array( array( 'taxonomy' => 'donors_catgory', 'field' => 'id', 'terms' => $category ) ); } $wp_query = new WP_Query($args); ob_start(); if ( $wp_query->have_posts() ) { $class_columns = ''; switch ($columns) { case 1: $class_columns = 'col-xs-12 col-sm-6 col-md-12 col-lg-12'; break; case 2: $class_columns = 'col-xs-12 col-sm-6 col-md-6 col-lg-6'; break; case 3: $class_columns = 'col-xs-12 col-sm-6 col-md-4 col-lg-4'; break; case 4: $class_columns = 'col-xs-12 col-sm-6 col-md-3 col-lg-3'; break; default: $class_columns = 'col-xs-12 col-sm-6 col-md-3 col-lg-3'; break; } ?> <div class="<?php echo esc_attr(implode(' ', $class)); ?>"> <div class="jw-donaters-items"> <div class="row"> <?php while ( $wp_query->have_posts() ) { $wp_query->the_post(); ?> <div class="<?php echo esc_attr($class_columns); ?> jw-donater-item"> <div class="jw-thumb"> <?php if ( has_post_thumbnail() ) the_post_thumbnail('jws-imge-crop-thumbnail-donors'); ?> <div class="jws-donater-content"> <?php if($show_job){ ?> <span class="jw-meta"><?php echo get_post_meta(get_the_ID(),'tb_donors_experience',true); ?></span> <?php } ?> <?php if($show_title){ ?> <h5 class="jw-name"><?php the_title(); ?></h5> <?php } ?> <?php if($show_donated){ ?> <div class="donated-inner"> <span class="jw-donated"><?php _e('Donated: ' , 'pain' ) ?><?php echo get_post_meta(get_the_ID(),'tb_donors_donatedposition',true); ?></span> </div> <?php } ?> </div> </div> </div> <?php } ?> </div> </div> <?php if($show_pagination){ ?> <nav class="jw-pagination" role="navigation"> <?php $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages, 'prev_text' => __( '<i class="fa fa-angle-double-left"></i>', 'pain' ), 'next_text' => __( '<i class="fa fa-angle-double-right"></i>', 'pain' ), ) ); ?> </nav> <?php } ?> </div> <?php } return ob_get_clean(); } if(function_exists('bcore_shortcode')) { bcore_shortcode('donars', 'jwsthemes_donars_func'); }