Guest User

Wordpress Gallery Template

a guest
Sep 28th, 2011
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Gallery
  4. */
  5. ?>
  6. <?php get_header(); ?>
  7.  
  8. <div id="content">
  9. <!-- add page content from editor above gallery -->
  10. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  11. <div class="post" id="post-<?php the_ID(); ?>">
  12. <div class="entry"><?php the_content(); ?></div>
  13. </div> <!-- end post -->
  14. <?php endwhile; endif; ?>
  15.  
  16.  
  17. <?php // ADD CUSTOM POST TYPE -> GALLERY in functions.php with sources below
  18. // http://www.vooshthemes.com/blog/wordpress-tip/create-a-professional-portfolio-using-wordpress-3-0-custom-post-types/
  19. // http://www.deluxeblogtips.com/2010/07/custom-post-type-with-categories-post.html
  20. if ( get_query_var('paged') ) {
  21. $paged = get_query_var('paged');
  22. } else if ( get_query_var('page') ) {
  23. $paged = get_query_var('page');
  24. } else {
  25. $paged = 1;
  26. }
  27. query_posts( array( 'post_type' => 'gallery', 'paged' => $paged, 'posts_per_page' => 8 ) );
  28. while (have_posts()) : the_post();
  29. ?>
  30.  
  31. <div class="gallery">
  32. <h2><?php the_title(); ?></h2>
  33. <?php the_post_thumbnail('gallery'); ?>
  34. <?php the_content(); ?>
  35. </div><!-- END ".gallery" -->
  36.  
  37. <?php endwhile; ?>
  38.  
  39. <?php // pagination in functions.php from http://design.sparklette.net/teaches/how-to-add-wordpress-pagination-without-a-plugin/
  40. if (function_exists("pagination")) {
  41. pagination($additional_loop->max_num_pages);}
  42. ?>
  43.  
  44. </div><!-- END "#content" -->
  45.  
  46. </div><!-- END "#container" -->
  47.  
  48. <?php get_footer(); ?>
  49.  
Advertisement
Add Comment
Please, Sign In to add comment