Wednesday, 7 August 2013

Wordpress custom field only displaying 10 posts

Wordpress custom field only displaying 10 posts

I've used wordpress Advanced Custom Fields plugin to make my portfolio
page. I've setup fields for the image, title, category and a yes/no for
weather the project is featured.
My code for the project page is as follows:
<?php
$args = array(
'post_type' => 'project'
);
$query = new WP_Query( $args );
?>
<?php Starkers_Utilities::get_template_parts( array(
'parts/shared/html-header', 'parts/shared/header' ) ); ?>
<h1 class="lead"><?php the_title(); ?></h1>
<div id="triggers">
<strong>Filter:</strong>
<span id="filterDouble">Filter All</span>
<span id="filter1">Filter 1</span>
<span id="filter2">Filter 2</span>
</div>
<ul id="gallery" class="group">
<?php if ( have_posts() ) while ( $query->have_posts() ) :
$query->the_post(); ?>
<li class="gallery_image" data-id="id-" data-type="<?php
the_field('project_category')?>">
<a rel="prettyPhoto[gallery]" class="zoom" href="<?php
echo the_field('image') ?>">
<img class="mag" src="<?php bloginfo('template_url');
?>/imgs/mag.png"/><div class="thumb_bg"></div>
<?php the_post_thumbnail('portfolio'); ?>
</a>
</li>
<?php endwhile; ?>
</ul>
Everything works fine, i can add projects. However My problem starts when
i hit 10 projects. After 10, it doesn't display anymore. I am using jpages
(jquery plugin) and filtrify to add filters to filer out the categories.
They work fine, i can filter by category and i see the correct images.
Even with the plugin scripts removed, i still only see a max of 10 posts.
Adding more than 10 simply pushes the earlier images off and it displays
the 10 latest.
So how can i stop it from being just 10.. My jpage script sets the
pagination to 12 per page, but this doesn't even get a chance to kick in.
I am thinking it's a post problem as I'm certain it's not the scripts.
I think I've traced an issue - I tested this: 'posts_per_page' => '20' -
Which DOES display my missing posts, however i don't want to set a number
as i might need lots. How can i define an unlimited number. Providing this
is the issue..
If any other code is needed, please let me know, but i think this is the
main part of what's controlling my posts appearing on the page.

No comments:

Post a Comment