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

xvegax on "Custom gallery needs a navigation/pagination"

$
0
0

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 fine now for some unknown reason I just do not get the navigation/pagination to work and I really would like to have only 9 pictures per page for example or whatever value fits the needs.

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' => 99999,
    '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(); ?>

Does anyone know how to add the pagination without using a plugin? I tried like four plugins and they just did not work fine here.


Viewing all articles
Browse latest Browse all 8245

Trending Articles