php - How to create custom wordpress gallery -


youtube link make easy understand : http://www.youtube.com/watch?v=9by-igzg6ms

i need group of images in wordpress link images next one. not professional in wordpress, getting problem while creating custom wordpress gallery plugins, please me if 1 can it's last day of project , have tried of articles, stackoverflow question , answer got nothing related this.

here code getting issue while more page button might because haven't created page that.

function add_gallery_shortcode($atts, $content = null) { $a = shortcode_atts(array(     'gallery_name' => '',     'sub_gallery' => '',     'per_page' => 4,         ), $atts);  $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; $args = array('post_type' => $a['gallery_name'], 'posts_per_page' => $a['per_page'], 'paged' => $paged);  $loop = new wp_query($args);  ?>  <?php while ($loop->have_posts()) : $loop->the_post(); ?>  <?php echo '<div class="thumbs">' . wp_get_attachment_link(get_post_thumbnail_id(), 'thumbnail') . '</div>';  endwhile;  echo '<div id="nav_next_previous"> <div id="next">' .     next_posts_link('more »', $loop->max_num_pages) . ' </div> <div id="prev">' .     previous_posts_link('« previous', $loop->max_num_pages) . ' </div> </div><!-- thumbs-nextpage-wrap close-->';} 

i attaching youtube video link how looks like, don't know how can create link next group of images. if there free plugin helpful.

thanks

next_posts_link , previous_posts_link used inside loop getting next or previous single post link.

you have use paginate_links function instead of next_posts_link

e.g.

   echo paginate_links( array(       'format' => '?paged=%#%',       'current' => max( 1, get_query_var('paged') ),       'total' => $loop->max_num_pages,       'prev_text' => '« previous',       'next_text' => 'more »',    ) ); 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -