的index.php如何改變主動類在PHP代碼
<?php
$cur_page = get_query_var('page') ? get_query_var('page') : 1; //get curent page
$offers_per_page = couponxl_get_option('offers_per_page');
$args = array(
'post_type' => 'offer',
'posts_per_page'=> $offers_per_page,
'post_status' => 'publish',
'meta_key' => 'offer_expire',
'orderby' => 'meta_value_num',
'page' => $cur_page,
'order' => 'ASC',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'offer_store',
'value' => get_the_ID(),
'compare' => '='
),
array(
'key' => 'offer_start',
'value' => current_time('timestamp'),
'compare' => '<='
),
array(
'relation' => 'OR',
array(
'key' => 'offer_expire',
'value' => current_time('timestamp'),
'compare' => '>='
),
array(
'key' => 'offer_expire',
'value' => '-1',
'compare' => '='
)
),
array(
'relation' => 'OR',
array(
'key' => 'deal_status',
'value' => 'sold_out',
'compare' => '!='
),
array(
'key' => 'deal_status',
'value' => 'sold_out',
'compare' => 'NOT EXISTS'
),
),
)
);
if(!empty($offer_type)){
$args['meta_query'][] = array(
'key' => 'offer_type',
'value' => $offer_type,
'compare' => '='
);
}
$offers = new WP_Query($args);
$page_links_total = $offers->max_num_pages;
$pagination_args = array(
'end_size' => 2,
'mid_size' => 2,
'total' => $page_links_total,
'current' => $cur_page,
'prev_next' => false,
'type' => 'array'
);
if(isset($offer_type)){
$pagination_args['format'] = !get_option('permalink_structure') ? '?page=%#%' : 'page/%#%';
}
$page_links = paginate_links($pagination_args);
$pagination = couponxl_format_pagination($page_links);
if($offers->have_posts()){
$col = 6;
if($offer_view == 'list'){
$col = 12;
}
?>
<?php if(!empty($pagination)): ?>
<div class="col-sm-<?php echo esc_attr($col) ?> masonry-item">
<ul class="pagination">
<?php echo $pagination; ?>
</ul>
</div>
<?php endif; ?>
function.php
function couponxl_format_pagination($page_links){
global $couponxl_slugs;
$list = '';
if (!empty($page_links)) {
foreach ($page_links as $page_link) {
if (strpos($page_link, 'page-numbers current') !== false) {
$page_link = str_replace("<span class='page-numbers current'>", '<a href="javascript:;">', $page_link);
$page_link = str_replace('</span>', '</a>', $page_link);
$list .= '<li class="active">'.$page_link.'</li>';
} else {
if (get_query_var($couponxl_slugs['coupon']) && get_option('permalink_structure')) {
$page_link = preg_replace('#coupon\\/(.*?)/#i', '', $page_link, -1);
} else {
$page_link = preg_replace('#(&\\#038\\;' . $couponxl_slugs['coupon'] . '|&' . $couponxl_slugs['coupon'] . ')=(.*?)&#i', '&', $page_link);
$page_link = preg_replace('#(&\\#038\\;' . $couponxl_slugs['coupon'] . '|&' . $couponxl_slugs['coupon'] . ')=(.*?)\'#i', '\'', $page_link);
}
$list .= '<li>' . $page_link . '</li>';
}
}
}
return $list;
}
當我改變頁號,以便頁面改變,但網頁活動類沒有改變始終是活動頁面數1,當我再次點擊頁面號碼1不工作時激活,並且在停用時不會改變。請告訴我我的分頁功能無法正常工作,主動代碼無法正常工作。
請點擊此鏈接: - http://www.cuponswall.in/store/flipkart-coupons-offers
分頁不工作本頁面
我在我的網站上有一個問題,當我在我的主頁上上傳選定的優惠券,但是當我再次刷新頁面時,優惠券顯示爲隨機未選擇更改優惠券,我也面臨這個問題我的其他內部頁面。 – cuponswall