Viewing file: template-prettyphoto.php (4.85 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php /** Template Name: PrettyPhoto Page **/ global $data; $tpl_body_id = 'prettyphoto'; get_header(); update_option('current_page_template','body_portfolio body_prettyphoto body_gallery_2col_pp');
global $wp_query; $template_name = get_post_meta( $wp_query->post->ID, '_wp_page_template', true );
$no_of_page_columns = get_post_meta( $wp_query->post->ID, 'kingsize_page_columns', true ); if(empty($no_of_page_columns)) $no_of_page_columns = "2columns";
?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <!--Page title start--> <?php if ( $data['wm_show_page_post_headers'] == "" || $data['wm_show_page_post_headers'] == "0" ) { ?> <div class="row header"> <div class="eight columns"> <h2 class="title-page"><?php the_title(); ?></h2> </div> </div> <?php } else { ?> <div class="row header"> <div class="eight columns"> <h2 class="title-page"></h2> </div> </div> <?php } ?> <!-- Ends Page title -->
<?php if($content = $post->post_content) { the_content(); } else { the_content(); } ?> <?php $checkPasswd = false; if (!empty($post->post_password)) { // if there's a password if(!post_password_required($post->ID)) { $checkPasswd = true; } else $checkPasswd = false; } else{ $checkPasswd = true; }
if($checkPasswd == true) : ?> <!-- Gallery with prettyPhoto plugin --> <div class="row gallery-space pV0H10"> <?php //getting the page Gallery attachments images $args = array('post_type' => 'attachment', 'post_parent' => $post->ID, 'orderby' => "menu_order ID", 'order' => ASC); $attachments = get_children($args); $url_post_img = "";
if ($attachments) { foreach ($attachments as $attachment) {
########### FIXING # OF COLUMN AND IMAGE URL ########### if($no_of_page_columns=="2columns"){ //$url_post_img = wm_image_resize('330','220', wp_get_attachment_url($attachment->ID),$str_crop); $div_layout = "six columns mobile-three"; $relative_gal = 'rel="prettyPhoto[gallery2col]"';
$class_gal = 'gallery_2col'; } elseif($no_of_page_columns=="3columns"){ //$url_post_img = wm_image_resize('220','140', wp_get_attachment_url($attachment->ID),$str_crop); $div_layout = "four columns mobile-four"; $relative_gal = 'rel="prettyPhoto[gallery3col]"';
$class_gal = 'gallery_3col'; } elseif($no_of_page_columns=="4columns"){ //$url_post_img = wm_image_resize('160','110', wp_get_attachment_url($attachment->ID),$str_crop); $div_layout = "three columns mobile-one"; $relative_gal = 'rel="prettyPhoto[gallery4col]"';
$class_gal = 'gallery_4col'; } elseif($no_of_page_columns=="grid"){ //$url_post_img = wm_image_resize('112','112', wp_get_attachment_url($attachment->ID),$str_crop); $div_layout = "six_col columns mobile-one"; $relative_gal = 'rel="prettyPhoto[galleryGrid]"';
$class_gal = 'gallery_grid'; }
/*Make it responsive V5*/ $url_post_img = wm_image_resize('950','600', wp_get_attachment_url($attachment->ID));
if(!empty($attachment->post_content)) $post_title = "<p>".strip_tags($attachment->post_content)."</p>"; else $post_title = $attachment->post_title;
$post_title = $attachment->post_title."<p>".strip_tags($attachment->post_content)."</p>";
if(get_post_meta($attachment->ID, '_wp_attachment_image_alt', true) == "") $post_alt = $attachment->post_title; else $post_alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);
?> <div class="<?php echo $div_layout;?> space-bottom mobile-fullwidth"> <div class="row"> <div class="twelve columns pV0H5"> <a class="<?php echo $class_gal;?> image" href="<?php echo wp_get_attachment_url($attachment->ID);?>" <?php echo $relative_gal;?> href="<?php echo wp_get_attachment_url($attachment->ID);?>" title="<?php echo $post_title; ?>"><img src="<?php echo $url_post_img;?>" alt="<?php echo $post_alt; ?>" title="<?php echo $attachment->post_title; ?>"/></a> </div> </div> </div> <?php } } ?> </div> <?php endif; //password protected check?>
<?php endwhile; ?> <?php endif;?> <!-- Gallery ends here --> <?php if ( $data['wm_show_comments'] == "1" ) {?> <?php comments_template( '/comments.php' ); ?> <?php } else { ?> <!-- No Comments --> <?php } ?>
<?php get_footer(); ?>
|