How can I add Pagination to my custom page
-
Hi all. I have a Video gallery custom page which will allow me to post YouTube videos.
Can someone please help me and tell me how to add pagination to this so that if 12 videos are shown on the page it will say “Next 12 ” at the bottom of the page.
This is a child theme btw.
get_header(); ?> <Div id="Showcaseting" role="show"> <?php FA_display_slider(291); ?> </div> <div id="primary" class="relative"> <? $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args= array( 'cat' => 1, 'paged' => $paged ); query_posts($args); ?> <div id="content" role="main"> <div id="galvidcontainer" > <h1>Videos</h1> <?php /* Loop the stuff from the videos post type */ $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'videos', 'posts_per_page' => 12 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); query_posts($args); ?> <div class="galvidpre"> <div class="galvidprevid glass"> <?php /* Set variables and create if stament */ $videosite = get_post_meta($post->ID, 'Video Site', single); $videoid = get_post_meta($post->ID, "Video ID", single); if ($videosite == vimeo) { echo '<iframe src="https://player.vimeo.com/video/'.$videoid.'" width="300" height="190" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'; } else if ($videosite == youtube) { echo '<a class="lbpModal" href="https://www.youtube.com/embed/'.$videoid.'"><img class="alignnone" src="https://img.youtube.com/vi/'.$videoid.'/0.jpg" alt="" width="300" height="190" /></a>'; } else { echo 'Please Select Video Site Via the CMS'; } ?> </div> <div class="galvidpretext"> <h1><?php the_title() ?></h1> <p> <?php /* this is just a limit on characters displayed */ $words = explode(" ",strip_tags(get_the_content())); $content = implode(" ",array_splice($words,0,20)); echo $content; ?> </p> </div> </div> <?php endwhile;?> </div> </div><!-- #content --> </div><!-- #primary -->
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘How can I add Pagination to my custom page’ is closed to new replies.