Pagination customization

I am working to develop this type of pagination: here

I am taking values and displaying them on same page and my code snippet is below and couldn’t make it why it is not working.

Read More
<?php
if ($_SERVER['REQUEST_METHOD'] == 'GET') 
{
    global $paged;
    if(empty($paged)) $paged = 1;
    else { $paged = $_GET['paged']; }
        if(isset($paged) && is_numeric($paged) && ($paged <= $pages) && ($paged >= 1))              //validation
        {    
            if($pages == '')
            {
                global $wp_query;
                $pages = $wp_query->max_num_pages;
                    if(!$pages) $pages = 1;
            }  

            if(1 != $pages)
            { ?>

    <form action="#" method="get" >

            page
            <input type="text" name="paged" value="<?php echo $paged; ?>">
            of <?php echo $pages; ?>
            <input type="submit">

    </form>

            <?php 
            if($paged > 1) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Prev Page</a>";
            if ($paged < $pages) echo "<a href="".get_pagenum_link($paged + 1)."">Next Page &rsaquo;</a>"; 
            }
        } 
} 

?>

Please suggest.

Related posts

Leave a Reply