WordPress.org

Ready to get started?Download WordPress

Forums

WP-Paginate
Implement in framework (1 post)

  1. jaspergrafisch
    Member
    Posted 1 year ago #

    Hi there,

    My framework has a (for me) complex code. Anybody know how to implement the wp-paginate code?
    :

    function xtreme_post_pagination() {
    	global $wp_query;
    	$options = get_option( XF_OPTIONS );
        $start = '<div class="pagination">';
        $end = '</div>';
        if ( xtreme_is_html5() ) {
            $start = '<nav class="pagination">';
            $end = '</nav>';
        }
        echo $start;
    	if (!isset($options['xc_pagination']) || $options['xc_pagination']['pagination_type']['value'] != 1) : ?>
        <div class="previous_link"><?php previous_posts_link(__('Newer Posts <span>→</span>', XF_TEXTDOMAIN)) ?></div>
        <div class="next_link"><?php next_posts_link(__('<span>←</span> Older Posts', XF_TEXTDOMAIN)) ?></div>
        <?php else: ?>
    	<?php
    		$type = (isset($options['xc_pagination']['type']['value']) ? $options['xc_pagination']['type']['value'] : 'plain');
    		$big = 999999999; // need an unlikely integer
    		$page_links = paginate_links( array(
    			'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
    			'format' => '?paged=%#%',
    			'current' => max( 1, get_query_var('paged') ),
    			'total' => $wp_query->max_num_pages,
    			'end_size' => (isset($options['xc_pagination']['end_size']['value']) ? (int)$options['xc_pagination']['end_size']['value'] : 1),
    			'mid_size' => (isset($options['xc_pagination']['mid_size']['value']) ? (int)$options['xc_pagination']['mid_size']['value'] : 2),
    			'show_all' => (isset($options['xc_pagination']['show_all']['value']) ? (bool)$options['xc_pagination']['show_all']['value'] : false),
    			'prev_next' => (isset($options['xc_pagination']['prev_next']['value']) ? (bool)$options['xc_pagination']['prev_next']['value']: true),
    			'type' => 'array'
    		) );
    		$page_links = apply_filters( 'xtreme_post_pagination', $page_links);
    		if (is_array($page_links)) {
    			switch($type) {
    				case 'list':
    					$r .= "<ul class='page-numbers'>\n\t<li>";
    					$r .= join("</li>\n\t<li>", $page_links);
    					$r .= "</li>\n</ul>\n";
    					break;
    				default:
    					$r = join("\n", $page_links);
    					break;
    			}
    		}else $r = (string)$page_links;
    		echo $r;
    	?>
    	<?php endif;
    	echo $end;
    }

    Best Regards,
    Jasper.

    http://wordpress.org/extend/plugins/wp-paginate/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic