Community Forums › Forums › Archived Forums › General Discussion › Pagination problem with wp-property plugin
Tagged: pagination
- This topic has 1 reply, 1 voice, and was last updated 9 years, 6 months ago by Blenderbox.
-
AuthorPosts
-
September 16, 2014 at 3:09 am #124625BlenderboxMember
I'm trying to use this plugin with my custom child theme but it always gives me some error.
First, the default properties page has an ajax pagination that doesn't work with Genesis Framework but it does with Twenty Fourteen theme. I posted in the support forum but they only told me that I'm getting this error: 'You don't have permission to access /cms/wp-admin/admin-ajax.php on this server.'.
I searched on google and tried the fix that everyone uses for this problem but it doesn't work for me.So I decided to create a custom template with custom loop and pagination, and everything it was working fine untill it wasn't. I can't understand why the pagination is not working anymore, when I go to the second page I get a 404 error.
I've deleted almost everything on my child theme but I can't get it to work again.I've tried the pre_get_posts function on functions.php file like this:
add_action( 'pre_get_posts', 'child_change_home_query', 1 ); function child_change_home_query( $query ) { if( !is_admin() && is_page_template( 'properties-template.php' ) ) { $query->set( 'posts_per_page', '6' ); } }
with no luck.
My properties template:
<?php /** * Template Name: Properties template */ // FORCE CONTENT SIDEBAR LAYOUT add_filter ( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' ); remove_action( 'genesis_loop', 'genesis_do_loop' ); // Add our custom loop add_action( 'genesis_loop', 'custom_properties_loop' ); function custom_properties_loop() { ?> <header class="entry-header"> <?php do_action( 'genesis_post_title' ); ?> </header> $args = array( 'post_type' => 'property', //'posts_per_page'=> 12, 'paged' => get_query_var( 'paged' ) ); global $wp_query; $wp_query = new WP_Query( $args ); ?> <div class="property_row"> <?php if( $wp_query->have_posts() ) { ?> <div class="all_properties"> <?php // loop through properties while( $wp_query->have_posts() ): $wp_query->the_post(); global $post; ?> <div class="property"> <div class="property_thumb"> <div class="property_image"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="property_overview_thumb property_overview_thumb_property thumbnail" rel="properties"> <?php echo genesis_get_image( array( size => 'property' ) ); ?> <div class="portfolio_image_fadder"></div></a> </div> </div> <div class="property_info"> <div class="property_overview"> <div class="property_title"> <a <?php echo $in_new_window; ?> href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </div> <?php $property_price = get_post_meta($post->ID, 'price', true); //$property_price = number_format($property_price, 0, ',', '.'); ?> <div class="property_price"><?php echo $property_price; ?> €</div> <div class="area"><?php echo get_post_meta($post->ID, 'area', true); ?></div> <div class="bedrooms"><?php echo get_post_meta($post->ID, 'bedrooms', true); ?></div> <div class="bathrooms"><?php echo get_post_meta($post->ID, 'bathrooms', true); ?></div> <?php $sold = get_post_meta($post->ID, 'sold', true); if($sold == 'Yes'): ?><div class="sold"><?php echo $sold; ?></div><?php endif; ?> </div> </div> </div> <?php endwhile; genesis_posts_nav(); ?> </div> <?php }else{ echo '<p>Sorry, no properties found - try expanding your search, or <a href="'. site_url( '/properties/').'">view all</a></p>'; } ?> </div> <?php wp_reset_query(); } genesis();
The properties page with my custom template is here
I don't know what else I can do. Please I need help!
Thanks.
http://dqhweb.com/inmo/properties/September 16, 2014 at 6:29 am #124639BlenderboxMemberI forgot the link with the plugin default property page with ajax pagination that doesn't work.
Thanks!
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.