1
喜有一個問題,即我不能讓分頁靜態頭版上工作,看着WordPress的抄本,做它說什麼,但建仍然沒有喜悅,分頁問題靜態頭版WordPress的
任何幫助不勝感激
<?php
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$type = 'Galleries';
$args=array(
'category_name' => 'Gallery',
'post_status' => 'publish',
'posts_per_page' => 2,
'paged' => $paged
);
$my_query = null;
$my_query = new WP_Query($args);
?>
<section id="maincontent" class="twelve columns">
<ul id="gallery_menu">
<?php if($my_query->have_posts()) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li class="gallery_titleframe">
<div class="gallery_titleborder">
<div class="gallery_titleimage">
<?php $str = get_the_ID() ; ?>
<a href="<?php the_permalink() ?>" title="<?php echo get_post_meta($str, 'gallery1', true); ?>">
<img src="<?php echo get_post_meta($str, 'gallery1', true); ?>" width="256" height="186">
</a>
</div>
</div>
<div class="gallery_titletext">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</div>
</li>
<?php endwhile;
} ?>
<div id="nav-below" class="navigation">
<div class="nav-previous"><?php next_posts_link(); ?></div>
<div class="nav-next"><?php previous_posts_link(); ?></div>
</div><!-- #nav-below -->
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
千恩萬謝現在,但仍然不能正常工作,下一個頁面鏈接包含相同的2個職位得到下一個頁面鏈接???嘗試用posts_per_page和showposts代替,無論如何都看不出問題,很奇怪 –
var_dump($ paged)'在第二頁上告訴你什麼? – Tom
var_dump給int(1) –