• 07-12-2012, 10:27:43
    #1
    Aşağıdaki kod ile yazarın yazılarını sayfalatarak listeliyorum. Ancak ikinci sayfaya geçince liste yine 1'den başlıyor. Listenin birinci sayfanın son rakamından itibaren devam etmesi için ne yapmamız gerekiyor.

      <?php
        $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
        ?>
    	
    
    	
        <h4>All Posts by <?php echo $curauth->nickname; ?>:</h4>
    
    
    <!-- The Loop -->
    <ol type="1">
    
    <?php query_posts($query_string.'&posts_per_page=25'); ?>
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	
            <li>
                <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
                <?php the_title(); ?></a>,
                <?php the_time('d M Y'); ?>
            </li>
    
        <?php endwhile; else: ?>
            <p><?php _e('No posts by this author.'); ?></p>
    
        <?php endif; ?>
    </ol>
    <!-- End Loop -->
       
    <?php pagination($additional_loop->max_num_pages);?>
    functions.php sayfasının ilgili kodları aşağıda. Sanırım bunlarda bir değişiklik yapmak gerekecek.

    function pagination($pages = '', $range = 3)
    { $showitems = ($range * 2)+1;
     global $paged; if(empty($paged)) $paged = 1;
     if($pages == '') {
     global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages)
     { $pages = 1; } }
     if(1 != $pages)
     { echo "<div class='pagination'><ul>";
     if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<li><a rel='nofollow' href='".get_pagenum_link(1)."'>&laquo; First</a></li>";
     if($paged > 1 && $showitems < $pages) echo "<li><a rel='nofollow' href='".get_pagenum_link($paged - 1)."' class='inactive'>&lsaquo; Previous</a></li>";
     for ($i=1; $i <= $pages; $i++)
     { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
     { echo ($paged == $i)? "<li class='current'><span class='currenttext'>".$i."</span></li>":"<li><a rel='nofollow' href='".get_pagenum_link($i)."' class='inactive'>".$i."</a></li>";
     } } if ($paged < $pages && $showitems < $pages) echo "<li><a rel='nofollow' href='".get_pagenum_link($paged + 1)."' class='inactive'>Next &rsaquo;</a></li>";
     if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a rel='nofollow' class='inactive' href='".get_pagenum_link($pages)."'>Last &raquo;</a>";
     echo "</ul></div>"; }}
  • 08-12-2012, 15:30:05
    #2
    yokmudur bir fikri olan, yol gösterecek, bir kaç kod yazıverecek şuraya.