• I don’t know what I’m doing wrong but wp-navi does not work on my homepage, when I use the same template as a single Page de wp-navi works.

    Here is my code:

    <?php
    
    $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    $upcoming = new WP_Query();
    $upcoming->query( array(
    	'post_type'=> 'tribe_events',
    	'eventDisplay' => 'upcoming',
    	'posts_per_page' => 3,
    	'paged' => $paged)
    );
    
    if ($upcoming->have_posts()) :
    	while ($upcoming->have_posts()) :
    		$upcoming->the_post();
    		?>
    
    <article <?php post_class('blog-entry clearfix'); ?>>
    	<?php
        // Get resize and show featured image : refer to functions/img_defaults.php for default values
        $wpex_entry_img = aq_resize( wp_get_attachment_url( get_post_thumbnail_id(), 'full' ),  wpex_img( 'blog_entry_width' ), wpex_img( 'blog_entry_height' ), wpex_img( 'blog_entry_crop' ) );
        	if($wpex_entry_img) {  ?>
            <div class="blog-entry-thumbnail">
                <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo $wpex_entry_img; ?>" alt="<?php echo the_title(); ?>" /></a>
            </div><!-- /blog-entry-thumbnail -->
        <?php } ?>
        <div class="entry-text clearfix">
            <header>
                <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php if (strlen($post->post_title) > 30) {
    echo substr(the_title($before = '', $after = '', FALSE), 0, 30 ) . '...'; } else {
    the_title();
    } ?></a></h2>
            </header>
           <div class="tribe-events-schedule updated published tribe-clearfix">
    		<h3><?php echo tribe_events_event_schedule_details(); ?></h3>
    		<?php echo tribe_events_event_recurring_info_tooltip(); ?>
    	</div>
    		<?php echo custom_field_excerpt(); ?><a class="more" href="<?php the_permalink(); ?>">[+]</a>
                 <!--  <span class="date">
            <?php // echo tribe_get_start_date( $post->ID, false, 'l  j F , Y' );?>
                   </span>
        </div><!-- /entry-text -->
        <div class="social">
         <?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>
        </div>
    </article><!-- /blog-entry -->
    
    <?php
    	endwhile;
    	if ( function_exists('wp_pagenavi') ) wp_pagenavi( array( 'query' => $upcoming ) ); // tell it which query we are paginating
    endif;
    wp_reset_query(); // important to reset the query
    ?>

    Thanks

    https://www.ads-software.com/support/plugin/wp-pagenavi/

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

  • The topic ‘Wp-Navi does not work on Homepage’ is closed to new replies.