• Joshua

    (@joshuavalentin)


    Hi,

    I can’t seem to get WP Paginate to work on the category.php page. I’m using a custom post type. Below the code I’m using:

    <?php
    
    	$custom_post_type		= 'kb';
    	$article				= get_term(get_queried_object()->term_id, 'category');
    	$taxonomy_child			= $article->slug;
    
    	$article = new WP_Query( array(
    		'post_type' 		=> $custom_post_type,
    		'category' 			=> $taxonomy_child,
    		'orderby' 			=> 'name',
    		'order' 			=> 'ASC'
    	));
    
    	if ( $article->have_posts() ) :
    ?>
    
    <ul class="article-links">
    	<?php if ( $article->have_posts() ) : while ( $article->have_posts() ) : $article->the_post(); ?>
    	<li>
    		<a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>"><i class="fa fa-file-text-o"></i><?php the_title(); ?></a>
    	</li>
    	<?php endwhile; else: ?>
    
    </ul>
    
    <p><?php _e( 'No artike;', 'kb' ); ?></p>
    
    <?php
    	endif;
    	wp_reset_query();
    
    	if(function_exists('wp_paginate')) {
    		wp_paginate();
    	}
    ?>

    https://www.ads-software.com/plugins/wp-paginate/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Eric

    (@emartin24)

    As far as I can tell, it looks like you have the pagination in the wrong place.

    I would think you should change:

    <?php endwhile; else: ?>
    <?php endwhile; 
    
    if(function_exists('wp_paginate')) {
    	wp_paginate();
    }
    
    else: ?>
    Thread Starter Joshua

    (@joshuavalentin)

    Hi Eric,

    I’ve changed the code but that still doesn’t seem to work.

    It does place an empty <div class="navigation"> </div>

    I’m using your plugin on multiple sites and it has always worked for me until now ?? What’s next?

    Plugin Author Eric

    (@emartin24)

    You could try and turn on php error reporting and/or check your web server’s error logs.

    Thread Starter Joshua

    (@joshuavalentin)

    I’m not getting any PHP errors. Function just isn’t getting displayed.

    i cant get next records using wp_paginate()….

    Hello,
    i’m using this plugin, the pagination show up in the category page and the number of post is what specified in the code ( which is 5) however, when i want to go to the next page (page 2 ) i’ve got the page ‘404 not found‘, i know that there still be videos in my data base,
    i put the code mentioned in the file loop-content.php , `
    Here is the code
    hope you help me set it

    <?php

    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    global $query_string;
    query_posts( $query_string .”&posts_per_page=5 &paged=$paged” );

    while (have_posts()) : the_post();
    get_template_part(‘item-video’);
    endwhile;

    if(function_exists(‘wp_paginate’)) {
    wp_paginate();

    }

    wp_reset_query();
    ?>

    Same problem as Joshua, only get the <div class=”navigation”></div> in my code. It worked fine a while ago, and the code never changed.

    <?php
    /*
    Template Name: Blog
    */
    ?>
    
    <?php get_header(); ?>
    
    <div id="news-wrapper">
    
    <?php if(function_exists('wp_paginate')) {
        wp_paginate();
    } ?>
    
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    
    	<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    		<div id="post-image">
    			<a href="<?php the_permalink(); ?>">
    			<?php
    				if ( has_post_thumbnail() )
    					the_post_thumbnail( 'blog-image' );
    				else
    					echo ' ';
    			?>
    			</a>
    		</div>
    
    		<?php the_title('<h2 class="blog-title"><a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h2>'); ?>
    
    		<div class="entry-content">
    			<?php the_excerpt(); ?>
    		</div>
    
    	</div>
    
    <?php endwhile; ?>
    
    <?php if(function_exists('wp_paginate')) {
        wp_paginate();
    } ?>
    
    </div>
    
    <?php else : ?>
    
    <p>Nothing found.</p>
    
    <?php endif; ?>
    
    <?php get_footer(); ?>
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WP Pagination not working in category.php’ is closed to new replies.