WordPress.org

Ready to get started?Download WordPress

Forums

Need help with pagination that doesn't work (2 posts)

  1. ebedgert
    Member
    Posted 11 months ago #

    I am using Cosmothemes News 24, and pagination doesn't work properly on my site. Clicking any "next" links just bumps me back to the main page of the site.

    I think this has to do with our server's settings (which I am not permitted to alter) interfering with the resetting of permalinks.

    The pagination code in the template is posted below. Does anyone have any suggestions for how I can create working pagination without having to reset permalinks?

    <?php
                                        global $wp_rewrite;
    
                                        $paged > 1 ? $current = $paged : $current = 1;
    
                                        $pagination = array(
                                            'base' => @add_query_arg('paged','%#%'),
                                            'format' => '',
                                            'total' => $posts->max_num_pages,
                                            'current' => $current,
                                            'show_all' => false,
                                            'prev_next'=> true,
                                            'prev_text'=> '&laquo;' . __( 'Previous' , 'cosmotheme' ),
                                            'next_text'=> __( 'Next' , 'cosmotheme' ) . ' &raquo;',
                                            'type' => 'array'
                                        );
    
                                        if( $wp_rewrite->using_permalinks() )
                                                $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
    
                                        if( !empty($posts->query_vars['s']) )
                                                $pagination['add_args'] = array( 's' => get_query_var( 's' ) );
    
                                        $pgn = paginate_links( $pagination );
                                        if( !empty( $pgn ) ){
                                        	echo '<div class="pag">';
                                            echo '<ul class="b_pag center p_b">';
                                            if( $current == 1 ){
                                                $current--;
                                            }
                                            foreach($pgn as $k => $link){
                                                print '<li>'.str_replace('class="prev ','class="no_link ',str_replace('class="next ','class="no_link ',str_replace("'",'"',$link) ) ).'</li>';
    
                                            }
                                            echo '</ul>';
                                            echo '</div>';
                                        }
                                    ?>
  2. esmi
    Forum Moderator
    Posted 11 months ago #

    I'm sorry but as you are using a commercial theme, you need to seek support from the theme's developer/vendor. We do not support commercial products here.
    Try http://cosmothemes.zendesk.com/

Reply

You must log in to post.

About this Topic