Viewing file: template-colorbox.php (4.47 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php /** Template Name: Colorbox Page **/ global $data; $tpl_body_id = 'colorbox'; get_header(); update_option('current_page_template','body_portfolio body_colorbox body_gallery_2col_cb');
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 --> <!-- PAGE CONTENT HERE --> <?php if($content = $post->post_content) { the_content(); } else { the_content(); } ?> <!-- END PAGE CONTENT HERE --> <?php $checkPasswd = false; //validating the password 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 ColorBox 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) { ########### TITLE AND ALT ########### $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);
########### FIXING # OF COLUMN AND IMAGE URL ########### if($no_of_page_columns=="2columns"){ $div_layout = "six columns mobile-three"; //$url_post_img = wm_image_resize('330','220', wp_get_attachment_url($attachment->ID)); $class_gal = 'gallery_2col image'; } elseif($no_of_page_columns=="3columns"){ $div_layout = "four columns mobile-four"; //$url_post_img = wm_image_resize('220','140', wp_get_attachment_url($attachment->ID)); $class_gal = 'gallery_3col image'; } elseif($no_of_page_columns=="4columns"){ $div_layout = "three columns mobile-one"; //$url_post_img = wm_image_resize('160','110', wp_get_attachment_url($attachment->ID)); $class_gal = 'gallery_4col image'; } elseif($no_of_page_columns=="grid"){ $div_layout = "six_col columns mobile-one"; //$url_post_img = wm_image_resize('112','112', wp_get_attachment_url($attachment->ID)); $class_gal = 'gallery_grid image'; }
/*Make it responsive V5 */ $url_post_img = wm_image_resize('950','600', wp_get_attachment_url($attachment->ID)); ?> <div class="<?php echo $div_layout;?> space-bottom mobile-fullwidth"> <div class="row"> <div class="twelve columns pV0H5"> <a class="<?php echo $class_gal;?>" href="<?php echo wp_get_attachment_url($attachment->ID);?>" title="<?php echo $post_title; ?>" alt=""><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(); ?>
|