我沒有找到任何方法來解決這種類型的錯誤。我在我的wordpress網站上添加了分頁。所有的東西都可以。但是當我點擊2 ,3,4 ...等頁面不改變其類.current
這就是爲什麼它沒有得到.current
類的CSS。對於畫廊。當前類沒有改變,當我點擊WordPress站點中的分頁
功能代碼:
function jellythemes_gallery($atts, $content=null) {
extract(shortcode_atts(array(
'limit' => -1
), $atts));
global $post;
$back=$post;
echo '<div id="portfolio">
<div class="section portfoliocontent">
<section id="i-portfolio" class="clear">';
// set up or arguments for our custom query
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$query_args = array(
'post_type' => 'media',
'posts_per_page' => 12,
'paged' => $paged
);
// create a new instance of WP_Query
$the_query = new WP_Query($query_args);
if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();
$image = get_post_meta($post->ID, '_jellythemes_media_photo', true);
$video = get_post_meta($post->ID, '_jellythemes_media_video', true);
$img = wp_get_attachment_image_src($image, 'media_thumb');
echo '<div class="ch-grid element">
<img class="ch-item" src="' . $img[0] .'" alt="' . get_the_title() . '" />';
if (empty($video)) {
echo '<a class="fancybox img-lightbox" rel="" href="' . $img[0] .'">';
} else {
echo '<a class="fancybox-media" rel="" href="' . $video.'">';
}
echo '<div>
<span class="p-category ' . (empty($video) ? 'photo' : 'video') . '"></span>
</div>
</a>
</div>';
endwhile;
$post=$back; //restore post object
$return .= '</section>
</div>
</div>';
echo "<div class='pagination_center'>";
if ($the_query->max_num_pages > 1) {
$current_page = max(1, get_query_var('paged'));
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => '/page/%#%',
'current' => $current_page,
'total' => $the_query->max_num_pages,
'show_all' => true,
'prev_text' => __('« PREV'),
'next_text' => __('NEXT »'),
'prev_next' => false,
));
}
else{
echo '<article>
<h1>Sorry...</h1>
<p>';echo 'Sorry, no posts matched your criteria.'; echo'</p>
</article>';
}
endif;
echo "</div>";
return $return;
}
add_shortcode('jellythemes_gallery', 'jellythemes_gallery');
CSS:
.pagination_center .current{
border: 1px solid #c3121c;
padding: 0px 5px;
color: black;
font-weight: bold;
background: #c3121c;
}
在這裏,我增加了一個image與檢查element.It是第2頁,但是,頁面1.可.current
類有人告訴我問題在哪裏?
在此先感謝。如果您需要進一步的任何代碼,請讓我知道。
你能告訴我們分頁代碼plz –
@ChoncholMahmud:你在哪裏添加類的JS代碼? –
你可以在這裏閱讀答案 - http://wordpress.stackexchange.com/questions/126080/changing-pagination-list-class –