WordPress.org

Ready to get started?Download WordPress

Forums

[closed] how do i add pagination to presswork theme? (1 post)

  1. stargirl1
    Member
    Posted 11 months ago #

    Hi, i'm wanting to add page numbers to static pages and the blog page of my theme. i'm using the presswork theme. my website is http://www.lizartlizard.com

    i've tried using plugins such as wp-pagenavi but there's nothing in the index or loop about pagination to replace the '<?php wp_pagenavi(); ?>' code.

    however, i found the following code in the functions file, but as i'm a wordpress coding novice, i have no idea what to do with it to get the pagination turned on.

    /**
     * Creates pagination.
     *
     * @since PressWork 1.0
     */
    	function pw_paginate() {
    		global $wp_query, $wp_rewrite;
    		$wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
    
    		$pagination = array(
    			'base' => @add_query_arg('paged','%#%'),
    			'format' => '',
    			'total' => $wp_query->max_num_pages,
    			'current' => $current,
    			'show_all' => false,
    			'type' => 'plain',
    			'next_text' => '»',
    			'prev_text' => '«'
    			);
    
    		if( $wp_rewrite->using_permalinks() )
    			$pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
    
    		if( !empty($wp_query->query_vars['s']) )
    			$pagination['add_args'] = array( 's' => get_query_var( 's' ) );
    
    		echo '<nav id="page-numbers">';
    		echo '<h3 class="assistive-text">Page navigation</h3>';
    		echo paginate_links( $pagination );
    		echo '</nav>';
    	}
    endif;


    [Please continue in your existing thread on this question - http://wordpress.org/support/topic/problems-installing-wp-pagenavi-plugin-on-presswork-theme?replies=4 ]

Topic Closed

This topic has been closed to new replies.

About this Topic