PluginProbe
Gallery by BestWebSoft – Customizable Image and Photo Galleries for WordPress / 2011.1.01
Gallery by BestWebSoft – Customizable Image and Photo Galleries for WordPress v2011.1.01
4.8.1 4.8.0 4.7.9 trunk 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 2.12 2011.1.01 2011.1.02 3.01 3.02 3.03 3.04 3.05 3.06 3.1 All 131 releases
gallery-plugin / themplate / gallery-template.php

gallery-template.php in Gallery by BestWebSoft – Customizable Image and Photo Galleries for WordPress 2011.1.01, at themplate/gallery-template.php

92 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Template Name: Gallery Template
4 */
5 ?>
6
7 <?php get_header(); ?>
8 <div id="container">
9 <div role="main" id="content">
10 <h1 class="home_page_title"><?php the_title(); ?></h1>
11 <div class="gallery_box">
12 <ul>
13 <?php
14 global $post;
15 global $wpdb;
16 global $wp_query;
17 $paged = $wp_query->query_vars["paged"];
18 $permalink = get_permalink();
19 if( substr( $permalink, strlen( $permalink ) -1 ) != "/" )
20 {
21 if( strpos( $permalink, "?" ) !== false ) {
22 $permalink = substr( $permalink, 0, strpos( $permalink, "?" ) -1 )."/";
23 }
24 else {
25 $permalink .= "/";
26 }
27 }
28 $count = 0;
29 $args = array(
30 'post_type' => 'gallery',
31 'post_status' => 'publish',
32 'orderby' => 'post_date',
33 'posts_per_page' => -1
34 );
35 $second_query = new WP_Query( $args );
36 $count_all_albums = count($second_query->posts);
37 $per_page = 5;
38 if( $paged != 0 )
39 $start = $per_page * ($paged - 1);
40 else
41 $start = $per_page * $paged;
42 if ($second_query->have_posts()) : while ($second_query->have_posts()) : $second_query->the_post();
43 if( $count < $start ) {
44 $count++;
45 continue;
46 }
47 if( ( $count - $start ) > $per_page - 1 )
48 break;
49
50 $attachments = get_children( 'post_parent='.$post->ID.'&post_type=attachment&post_mime_type=image&numberposts=1' );
51 $id = key($attachments);
52 $image_attributes = wp_get_attachment_image_src( $id, 'album-thumb' );
53 $count++;
54 ?>
55 <li>
56 <img style="width:120px;" alt="<?php echo $post->post_name; ?>" title="<?php echo $post->post_name; ?>" src="<?php echo $image_attributes[0]; ?>" />
57 <div class="gallery_detail_box">
58 <div><?php echo $post->post_title; ?></div>
59 <div><?php echo the_excerpt_max_charlength(100); ?></div>
60 <a href="<?php echo $permalink; echo basename( get_permalink( $post->ID ) ); ?>">See foto's &raquo;</a>
61 </div>
62 <div class="clear"></div>
63 </li>
64 <?php endwhile; endif; wp_reset_query(); ?>
65 </ul>
66 <?php
67 if( $paged == 0 )
68 $paged = 1;
69 $pages = intval ( $count_all_albums/$per_page );
70 if( $count_all_albums % $per_page > 0 )
71 $pages +=1;
72 $showitems = 5;
73 $range = 100;
74 if( ! $pages ) {
75 $pages = 1;
76 }
77 if( 1 != $pages ) {
78 echo "</div><div class='clear'></div><div class='pagination'>";
79 for ( $i = 1; $i <= $pages; $i++ ) {
80 if ( 1 != $pages && ( !( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
81 echo ( $paged == $i ) ? "<span class='current'>". $i ."</span>":"<a href='". get_pagenum_link($i) ."' class='inactive' >". $i ."</a>";
82 }
83 }
84
85 echo "<div class='clear'></div></div>\n";
86 } else {?>
87 </div>
88 <?php } ?>
89 </div>
90 </div>
91 <?php get_sidebar(); ?>
92 <?php get_footer(); ?>