• I am new to wp.
    This code returns a list of links pagination of a category.
    The second time a user clicks the generated links then the functionality returns a page that does not exist.

    eg.
    The category link (first paginated page) is http://www.mypage.com/mycategory#all WORKS OK
    the first click returns this link http://www.mypage.com/mycategory/page/2 WORKS OK
    the second click returns this link http://www.mypage.com/mycategory/page/2page/3 NOT OK

    Why the code removes #all but not page/2 from the link?
    What am I doing wrong and how can I improve the code?

    The code I used:

    <?php
    if($loop->max_num_pages>1){?>
        <?php
        for($i=1;$i<=$loop->max_num_pages;$i++){?>
            <a href="<?php echo get_category_link($category_id).'page/'.$i;?>" <?php echo ($paged==$i)? 'class="active"':'';?>><?php echo $i;?></a>
            <?php
        }
        if($paged!=$loop->max_num_pages){?>
            <a href="<?php echo get_category_link($category_id).'page/'.$i;?>">Next</a>
        <?php } ?>
    <?php } ?>
  • The topic ‘Broken browsing through category links pagination.’ is closed to new replies.