PluginProbe
Gallery by BestWebSoft – Customizable Image and Photo Galleries for WordPress / 2.04
Gallery by BestWebSoft – Customizable Image and Photo Galleries for WordPress v2.04
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 2.04, at template/gallery-template.php

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