• I’ve created a few custom templates for my genesis theme and I cannot get the post navigation to work. I’ve spent many hours looking and trying code to no avail. Any help would be great. Here’s my template

    `add_action( ‘genesis_loop’, ‘custom_do_loop’ ); // Add custom loop
    function custom_do_loop() {
    global $post;
    // arguments, adjust as needed
    $args = wp_parse_args(
    genesis_get_custom_field( ‘query_args’ ),
    array(
    ‘post_type’ => ‘post’,
    ‘posts_per_page’ => 10,
    ‘post_status’ => ‘publish’,
    ‘cat’ => $include,
    ‘paged’ => get_query_var( ‘paged’ ) )
    );

    global $wp_query;
    $wp_query = new WP_Query( $args );
    if ( have_posts() ) :
    while ( have_posts() ) : the_post();
    echo ‘<div class=”post entry”>’;
    echo ‘<h2> <a href=”‘ . get_permalink() .'”> ‘. get_the_title() .’ </a> </h2>’; // show the title
    echo ‘<a href=”‘ . get_permalink() .'” title=”‘ . the_title_attribute( ‘echo=0’ ) . ‘”>’; // Original Grid
    echo ‘</a>’;
    the_excerpt();
    echo ‘</div>’;
    endwhile;
    endif;
    wp_reset_query();
    }

    // Remove header, navigation, breadcrumbs, footer widgets, footer
    add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_full_width_content’ );

    remove_action( ‘genesis_header’, ‘genesis_header_markup_open’, 5 );
    remove_action( ‘genesis_header’, ‘genesis_do_header’ );
    remove_action( ‘genesis_header’, ‘genesis_header_markup_close’, 15 );
    remove_action( ‘genesis_after_header’, ‘genesis_do_nav’ );
    remove_action( ‘genesis_after_header’, ‘genesis_do_subnav’ );
    remove_action( ‘genesis_before_loop’, ‘genesis_do_breadcrumbs’);
    remove_action( ‘genesis_before_footer’, ‘genesis_footer_widget_areas’ );
    remove_action( ‘genesis_footer’, ‘genesis_footer_markup_open’, 5 );
    remove_action( ‘genesis_footer’, ‘genesis_do_footer’ );
    remove_action( ‘genesis_footer’, ‘genesis_footer_markup_close’, 15 );
    genesis();`

    I’m not sure if my query arguments are wrong or if I’m missing a genesis action. Any help would be great.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I have enabled this in my archive-sale.php file
    My custom post type is called ‘sale’ in my functions.php file, so that’s why you see ‘sale’ with everything below

    <?php
    
    remove_action('genesis_loop','genesis_do_loop');
    add_action('genesis_loop','surefire_loop_helper');
    
    function surefire_loop_helper() {
    $per_page = 3;
    $sale_args = array('post_type' => 'sale','posts_per_page' => $per_page,'paged' => get_query_var( "paged" ));
    $sale = new WP_Query( $sale_args );
    ?>
    
    if ( have_posts() ) :
    	
    //Create a standard wordpress loop
    while ( have_posts() ) : the_post(); 
    
    the_title() 
    	
    the_post_thumbnail('medium') 
    
    endwhile;
    
    //* IF you want NEXT Older
    next_posts_link( 'Older posts' );
    previous_posts_link( 'Newer posts' );
    //* IF YOU WANT NUMBERED
    genesis_posts_nav();
    	
    else : ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; 
    }
    
    genesis();

    this link helped me as well http://www.billerickson.net/code/pagination-in-a-custom-query/

    • This reply was modified 7 years, 10 months ago by jbbaab44. Reason: added link to additional resource
    • This reply was modified 7 years, 10 months ago by jbbaab44.
    • This reply was modified 7 years, 10 months ago by jbbaab44.

    Sorry the per_page is not set in the archive.php code above. it actually pulls the page number from the wordpress ‘reading’ settings.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom archive template not showing pagination’ is closed to new replies.