WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
Wp-Navi does not work on Homepage (1 post)

  1. jmbalsa
    Member
    Posted 7 months ago #

    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

    http://wordpress.org/support/plugin/wp-pagenavi/

    http://wordpress.org/plugins/wp-pagenavi/

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.