Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

xvegax on "Custom Gallery showing only 5 images instead all"

$
0
0

Hi guys,

With someone's help I created a custom gallery script, which is loading all images with a certain "slug", e.g. "people", "scenery", ...

It does work with one exception: It shows only five pictures and does not show the rest ... and I just can not find the culprit for that. :(

Here is an example website: studio-scs.de/people.

Here is my code:

<?php
/**
* Template Name: Scenery Gallery
*/

get_header(); ?>

 <h2 class="gross"><?php the_title(); ?></h2>

 <div id="inhalt">

 <div class="entry">

 <?php

    $scenery_attachments = new WP_Query( array(
    'post_type' => 'attachment',
    'post_status' => 'inherit',
    'posts_per_page' => 0,
    'category_name' => 'scenery', // note: use category SLUG
    ) );

    $scenery_id_array = array();

    if ( $scenery_attachments->have_posts() ) : while ( $scenery_attachments->have_posts() ) : $scenery_attachments->the_post();

    $scenery_id_array[] = get_the_ID();

    endwhile; endif;
    // Important!
    wp_reset_postdata();

    $scenery_ids = implode( ',', $scenery_id_array );

    echo do_shortcode( '[gallery link="file" columns="5" order="DESC" orderby="ID" include="' . $scenery_ids . '"]' );

 ?>

 </div>

 <?php // get_sidebar(); ?>

<?php get_footer(); ?>

Someone sees what is wrong? Apart from showing not all pictures, it seems to work just fine.


Viewing all articles
Browse latest Browse all 8245

Trending Articles