• Resolved Danny159

    (@danny159)


    Hey guys,

    I am having trouble with my loop…
    I have the following code….

    <?php /* Template Name: Portfolio  */ ?>
    
    <?php get_header(); ?>
    
    <?php
    // Query Out Database
    $wpbp = new WP_Query(array( 'post_type' => 'portfolio', 'posts_per_page' => '1' ) ); 
    
    // Begin The Loop
    if ($wpbp->have_posts()) : while ($wpbp->have_posts()) : $wpbp->the_post();
    ?>
    
    <div class="portfolio">
    <?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) : ?>
    	<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('portfolio'); ?></a>
    <?php endif; ?>
    	<div class="portinfo">
        <a href="<?php the_permalink(); ?>"><span><?php echo get_the_title(); ?></span></a>
        <p>Lorem ipsum dolor sit amet consecti un atis al nord di amur. Lorem ipsum dolor sit amet conescti un atis al nord di amur. Lorem ipsum dolor sit amet conescti un atis al nord di amur.</p>
        </div>
    </div>
    
    <?php endwhile; ?>
    <?php else : ?>
    <h2>Not Found</h2>
    <?php endif; ?>
    
    <div class="navigation">
    	<div class="next-posts"><?php next_posts_link('&laquo; Older Entries') ?></div>
    	<div class="prev-posts"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    </div>
    
    <?php wp_reset_query(); ?>
    <?php get_footer(); ?>

    And I cant get the page navigation to show… it just doesn’t seem to want to work… I have 2 posts so it should let me go to previous posts but doesn’t?

    Can anyone help?

    Dan

Viewing 1 replies (of 1 total)
  • Thread Starter Danny159

    (@danny159)

    Ahh fixed, see this guys code:

    <?php
    global $wp_query;
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $args = array(
    	'post_type' => 'CUSTOM_POST_NAME',
    	'product_category' => 'CATEGORY_NAME',
    	'posts_per_page' => 6,
    	'post_status' => 'publish',
    	'orderby' => 'menu_order',
    	'order' => 'DESC',
    	'paged' => $paged
    );
    $wp_query = new WP_Query($args);
    
    while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
    	<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a>
    <?php endwhile; ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Paging not working’ is closed to new replies.