WP Query for all posts
-
I have page-property.php in the loop folder with this code. And I see only 8 posts (Custom Post type), but I want to see all of them with pagination, what’s wrong?
<?php /** * Default Page /* Template Name: property-page */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $_pojo_parent_id; ?> <?php $view = 'archive'; if ( is_singular() ) $view = 'single'; elseif ( is_search() ) $view = 'search'; elseif ( is_404() ) $view = '404'; if ( Pojo_Compatibility::is_bbpress_installed() && is_bbpress() ) $view = 'page'; do_action( 'pojo_setup_body_classes', $view, get_post_type(), '' ); get_header(); do_action( 'pojo_get_start_layout', $view, get_post_type(), '' ); ?> <header> <?php if ( po_breadcrumbs_need_to_show() ) : ?> <?php pojo_breadcrumbs(); ?> <?php endif; ?> <?php if ( pojo_is_show_page_title() ) : ?> <div class="page-title"> <h1><?php the_title(); ?></h1> </div> <?php endif; ?> </header> <?php the_content(); ?> <?php global $_pojo_parent_id, $custom_query; $_pojo_parent_id = get_the_ID(); $pagination = atmb_get_field( 'po_pagination' ); $display_type = po_get_display_type(); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array ( 'post_type' => 'property', 'post_per_page' => 8, 'paged' => $paged ); $custom_query = new WP_Query( $args ); ?> <?php if ( post_password_required( $_pojo_parent_id ) ) : ?> <?php echo get_the_password_form( $_pojo_parent_id ); ?> <?php else : ?> <?php if ( $custom_query->have_posts() ) : ?> <?php do_action( 'pojo_before_content_loop', $display_type ); ?> <?php while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?> <?php pojo_get_content_template_part( 'content', $display_type ); ?> <?php endwhile; ?> <?php do_action( 'pojo_after_content_loop', $display_type ); ?> <?php if ( 'hide' !== $pagination ) : ?> <?php pojo_paginate( ); ?> <?php endif; ?> <?php echo apply_filters( 'the_content', '' ); ?> <?php endif; ?> <?php endif; ?> <?php pojo_button_post_edit(); ?> <?php do_action( 'pojo_get_end_layout', $view, get_post_type(), '' ); get_footer(); ?>The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘WP Query for all posts’ is closed to new replies.