PluginProbe
Gallery by BestWebSoft – Customizable Image and Photo Galleries for WordPress / 3.03
Gallery by BestWebSoft – Customizable Image and Photo Galleries for WordPress v3.03
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 / template / gallery-template.php

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

100 lines 3.6 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 <?php if ( function_exists( 'pdfprnt_show_buttons_for_custom_post_type' ) ) echo pdfprnt_show_buttons_for_custom_post_type( 'post_type=gallery&orderby=post_date' ); ?>
12 <div class="gallery_box">
13 <ul>
14 <?php
15 global $post;
16 global $wpdb;
17 global $wp_query;
18 $paged = $wp_query->query_vars["paged"];
19 $permalink = get_permalink();
20 $gllr_options = get_option( 'gllr_options' );
21 if( substr( $permalink, strlen( $permalink ) -1 ) != "/" )
22 {
23 if( strpos( $permalink, "?" ) !== false ) {
24 $permalink = substr( $permalink, 0, strpos( $permalink, "?" ) -1 )."/";
25 }
26 else {
27 $permalink .= "/";
28 }
29 }
30 $count = 0;
31 $args = array(
32 'post_type' => 'gallery',
33 'post_status' => 'publish',
34 'orderby' => 'post_date',
35 'posts_per_page' => -1
36 );
37 $second_query = new WP_Query( $args );
38 if ( function_exists( 'pdfprnt_show_buttons_for_custom_post_type' ) ) echo pdfprnt_show_buttons_for_custom_post_type( $second_query );
39 $count_all_albums = count($second_query->posts);
40 $per_page = $showitems = get_option( 'posts_per_page' );
41 if( $paged != 0 )
42 $start = $per_page * ($paged - 1);
43 else
44 $start = $per_page * $paged;
45 if ($second_query->have_posts()) : while ($second_query->have_posts()) : $second_query->the_post();
46 if( $count < $start ) {
47 $count++;
48 continue;
49 }
50 if( ( $count - $start ) > $per_page - 1 )
51 break;
52
53 $attachments = get_post_thumbnail_id( $post->ID );
54 if( empty ( $attachments ) ) {
55 $attachments = get_children( 'post_parent='.$post->ID.'&post_type=attachment&post_mime_type=image&numberposts=1' );
56 $id = key($attachments);
57 $image_attributes = wp_get_attachment_image_src( $id, 'album-thumb' );
58 }
59 else {
60 $image_attributes = wp_get_attachment_image_src( $attachments, 'album-thumb' );
61 }
62 $count++;
63 ?>
64 <li>
65 <img style="width:<?php echo $gllr_options['gllr_custom_size_px'][0][0]; ?>px;" alt="<?php echo $post->post_title; ?>" title="<?php echo $post->post_title; ?>" src="<?php echo $image_attributes[0]; ?>" />
66 <div class="gallery_detail_box">
67 <div><?php echo $post->post_title; ?></div>
68 <div><?php echo the_excerpt_max_charlength(100); ?></div>
69 <a href="<?php echo $permalink; echo basename( get_permalink( $post->ID ) ); ?>"><?php echo __( 'See photo &raquo;', 'gallery' ); ?></a>
70 </div>
71 <div class="clear"></div>
72 </li>
73 <?php endwhile; endif; wp_reset_query(); ?>
74 </ul>
75 <?php
76 if( $paged == 0 )
77 $paged = 1;
78 $pages = intval ( $count_all_albums/$per_page );
79 if( $count_all_albums % $per_page > 0 )
80 $pages +=1;
81 $range = 100;
82 if( ! $pages ) {
83 $pages = 1;
84 }
85 if( 1 != $pages ) {
86 echo "</div><div class='clear'></div><div class='pagination'>";
87 for ( $i = 1; $i <= $pages; $i++ ) {
88 if ( 1 != $pages && ( !( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
89 echo ( $paged == $i ) ? "<span class='current'>". $i ."</span>":"<a href='". get_pagenum_link($i) ."' class='inactive' >". $i ."</a>";
90 }
91 }
92
93 echo "<div class='clear'></div></div>\n";
94 } else {?>
95 </div>
96 <?php } ?>
97 </div>
98 </div>
99 <?php get_sidebar(); ?>
100 <?php get_footer(); ?>