Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ( get_query_var( ‘paged’ ) )
- $paged = get_query_var(‘paged’);
- else if ( get_query_var( ‘page’ ) )
- $paged = get_query_var( ‘page’ );
- else
- $paged = 1;
- $per_page = 1;
- $number_of_series = count( get_terms( array( 'taxonomy' => 'attornies_cat' ) ) );
- $offset = ( ( $paged - 1 ) * $per_page );
- $terms = get_terms( array(
- 'taxonomy' => 'attornies_cat',
- 'orderby' => 'term_id',
- 'order' => 'ASC',
- 'offset' => $offset,
- 'number' => $per_page,
- ) );
- if ( $terms && !is_wp_error( $terms ) ) :
- ?>
- <?php foreach ( $terms as $term ) : ?>
- <!-- ATTORNEY DISTRICT AREA -->
- <div class="attorney-district-area">
- <h2><?php echo $term->name; ?></h2>
- <div class="row">
- <?php
- $attornies_post_type = new WP_Query( array(
- 'post_type' => 'attornies',
- 'orderby' => 'menu_order',
- 'order' => 'ASC',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'attornies_cat',
- 'field' => 'name',
- 'terms' => $term->name,
- )
- )
- ) );
- if( $attornies_post_type->have_posts() ) :
- while( $attornies_post_type->have_posts() ) : $attornies_post_type->the_post();
- $attorney_sec_meta = get_post_meta($post->ID, '_custom_meta_options', true);
- ?>
- <!-- SINGLE ATTORNEY -->
- <div class="col-md-4 col-sm-6">
- <div class="single-attorney">
- <div class="single-attorney-img">
- <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'attorney_thumb' ); } ?>
- <div class="single-attorney-link">
- <a href="#"><i class="fa fa-link" aria-hidden="true"></i></a>
- </div>
- </div>
- <div class="single-attorney-con">
- <h3><?php the_title(); ?></h3>
- <?php if( $attorney_sec_meta[ 'attorney_phone_no' ] ) : ?>
- <span><?php echo $attorney_sec_meta[ 'attorney_phone_no' ] ?></span>
- <?php endif; ?>
- </div>
- </div>
- </div><!-- // END SINGLE ATTORNEY -->
- <?php
- endwhile;
- wp_reset_postdata();
- endif;
- ?>
- </div>
- </div><!-- // END ATTORNEY DISTRICT AREA -->
- <?php
- endforeach;
- // Attorney Pagination
- echo '<div>';
- $big = 999999;
- echo paginate_links( array(
- 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
- 'format' => '?paged=%#%',
- 'current' => $paged,
- 'total' => ceil( $number_of_series / $per_page ),
- ) );
- echo '</div>';
- endif; ?>
Add Comment
Please, Sign In to add comment