taxonomy-wpdmcategory.php
95 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Base: wpdmpro |
| 4 | * Developer: shahjada |
| 5 | * Team: W3 Eden |
| 6 | * Date: 30/5/20 13:44 |
| 7 | */ |
| 8 | if(!defined("ABSPATH")) die(); |
| 9 | |
| 10 | get_header(); |
| 11 | |
| 12 | $category = get_queried_object(); |
| 13 | $cpage_global = maybe_unserialize(get_option('__wpdm_cpage')); |
| 14 | $cpage_global = !is_array($cpage_global) ? [ 'template' => 'link-template-default', 'cols' => 2, 'colsphone' => 1, 'colspad' => 1, 'heading' => 1 ] : $cpage_global; |
| 15 | |
| 16 | $cpage = maybe_unserialize(get_term_meta(get_queried_object_id(), '__wpdm_pagestyle', true)); |
| 17 | $cpage = !is_array($cpage) ? $cpage_global : $cpage; |
| 18 | if(get_queried_object_id() > 0) |
| 19 | $cpage['categories'] = $category->slug; |
| 20 | $cpage['toolbar'] = (int)$cpage['heading']; |
| 21 | $cpage['async'] = 1; |
| 22 | $cpage['paging'] = 1; |
| 23 | $cols = 12/$cpage['cols']; |
| 24 | $colspad = 12/$cpage['colspad']; |
| 25 | $colsphone = 12/$cpage['colsphone']; |
| 26 | if(wpdm_query_var('skw', 'txt') !== '') $cpage['s'] = wpdm_query_var('skw', 'txt'); |
| 27 | ?> |
| 28 | <div class="w3eden"> |
| 29 | <div class="container pt-3"> |
| 30 | |
| 31 | <?php do_action("wpdm_before_category_page_content", $category); ?> |
| 32 | |
| 33 | <div class="row"> |
| 34 | <div class="col-md-12"> |
| 35 | <div class="pb-5"> |
| 36 | <?php |
| 37 | if($cpage['toolbar'] === 1) |
| 38 | echo WPDM()->package->shortCodes->packages( $cpage ); |
| 39 | else { |
| 40 | //Global query data |
| 41 | echo "<div class='row'>"; |
| 42 | while (have_posts()) { |
| 43 | the_post(); |
| 44 | echo "<div class='col-lg-{$cols} col-md-{$colspad} col-sm-{$colsphone}'>" . WPDM()->package->fetchTemplate($cpage['template'], get_the_ID()) . "</div>"; |
| 45 | } |
| 46 | echo "</div>"; |
| 47 | |
| 48 | global $wp_rewrite; |
| 49 | $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1; |
| 50 | |
| 51 | $pagination = array( |
| 52 | 'base' => add_query_arg( 'paged', '%#%' ), |
| 53 | 'format' => '', |
| 54 | 'total' => $wp_query->max_num_pages, |
| 55 | 'current' => $current, |
| 56 | 'show_all' => false, |
| 57 | 'type' => 'list', |
| 58 | 'prev_next' => true, |
| 59 | 'prev_text' => '<i class="far fa-arrow-alt-circle-left"></i> ' . __( 'Previous', 'attire' ), |
| 60 | 'next_text' => __( 'Next', 'attire' ) . ' <i class="far fa-arrow-alt-circle-right"></i>', |
| 61 | 'screen_reader_text' => '', |
| 62 | ); |
| 63 | |
| 64 | if ( $wp_rewrite->using_permalinks() && ! is_search() ) { |
| 65 | $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' ); |
| 66 | } |
| 67 | |
| 68 | if ( ! empty( $wp_query->query_vars['s'] ) ) { |
| 69 | $pagination['add_args'] = array( 's' => get_query_var( 's' ) ); |
| 70 | } |
| 71 | ?> |
| 72 | <div class="text-center p-3"> |
| 73 | <div class="d-inline-block"> |
| 74 | <?php |
| 75 | echo str_replace( '<ul class=\'page-numbers\'>', |
| 76 | '<ul class="pagination pagination-centered page-numbers">', |
| 77 | get_the_posts_pagination( $pagination ) ); |
| 78 | ?> |
| 79 | </div> |
| 80 | </div> |
| 81 | <?php |
| 82 | } |
| 83 | ?> |
| 84 | </div> |
| 85 | </div> |
| 86 | </div> |
| 87 | |
| 88 | <?php do_action("wpdm_after_category_page_content", $category); ?> |
| 89 | |
| 90 | </div> |
| 91 | </div> |
| 92 | <?php |
| 93 | |
| 94 | get_footer(); |
| 95 |