Implementing pagination
-
Hi
I used CCTM to create a new post type, but I am having problems with pagination.
Here is my code :<?php //Fix homepage pagination if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } else if ( get_query_var('page') ) {$paged = get_query_var('page'); } else {$paged = 1; } $temp = $wp_query; // re-sets query $wp_query = null; // re-sets query $args = array('post_type' => 'Track', 'orderby'=>'date', 'order'=>'DESC', 'posts_per_page' => 1, 'paged' => $paged); $wp_query = new WP_Query(); $wp_query->query( $args ); while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <div class="post-inner pad-10"><div class="zChenarPost"> <div class="zPinkTop"> <div class="zArtistTop"><?php $my_array = get_custom_field('trackArtist:to_array');$artistString = implode(" , ", $my_array);print $artistString?></div> <div class="zTrackNameTop"><?php print_custom_field('trackName'); ?></div> </div> <div class="zPostSpacer"></div> <div class="zTrackInfoTags"><?php print_custom_field('trackReleaseDate'); ?></div> <div class="zTrackInfoTags"><?php print_custom_field('trackLabel'); ?></div> <div class="zTrackInfoTags"><?php print_custom_field('trackCountry'); ?></div> <div class="zTrackInfoTags"><?php print_custom_field('trackBPM'); ?> BPM</div> <div class="zTrackInfoTags"><?php print_custom_field('trackLength'); ?></div> <div class="zTrackInfoTags"><?php $my_array = get_custom_field('trackGenre:to_array');foreach ($my_array as $item) { print $item; }?></div> <div class="zPostSpacer"></div> <?php $trackLinkX = get_custom_field('trackLink'); ?> <?php $trackImageX = get_custom_field('trackAvatar'); ?> <?php echo '<img class="zPlayerImage" src="'.$trackImageX.'">';?> <?php echo '<div link="'.$trackLinkX.'" class="zPlayerContainer" id="player'.get_the_id().'">'; ?> <div class="zPlayerSeek"> <div class="zPlayerSeekBar"></div> </div> <div class="zPlayerStartTime">00:00</div> <div class="zPlayerEndTime">00:00</div> <img class="zPlayerPlayBtn" src="img/playBtn.png"></img> <img class="zPlayerPauseBtn" src="img/pauseBtn.png"></img> </div> </div> </div> <?php endwhile;?> <?php if(function_exists('wp_paginate')) { wp_paginate(); } ?>However when I click on the generated links, it gives me a 404.
My website is publicjams.com, you can see for yourself.
For some reason if I go directly to publicjams.com?page=2, it works..http://ww.wp.xz.cn/extend/plugins/custom-content-type-manager/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Implementing pagination’ is closed to new replies.