For some reason this query is only returning the 10 most recently published results, there should be at least 15 or so. So my question is, if I don’t specify the number of results in my query, will WordPress default to 10 or something?
<?php getGallery('test', 'test2'); ?>
function getGallery($galleryLink, $altLink){
global $post;
// search for any pages with a custom field of 'test'
query_posts('meta_key='.$galleryLink.'&post_type=page');
if (have_posts()) while (have_posts()) : the_post();
$link = get_post_meta($post->ID, $galleryLink, true);
$alt = get_post_meta($post->ID, $altLink, true);
$permalink = get_permalink($id);?>
<a href='<?php echo $permalink ?>'><img src="<?php echo $link ?>" alt="<?php echo $alt ?>"/></a>
<?php endwhile;
wp_reset_query();
}
default number of returned posts in $wp_query is defined in Dashboard > Settings > Reading. There you have defined 10, but remember that other people can set diffrent number on their blogs.
i hope you know that if you want to define your own number of posts you should add posts_per_page=X to query 🙂 if you want to always return all posts matched to query put -1 in place of X