<?php /******************************/ /**** AC Showcase Template ****/ /******************************/ global $post; // Template to style a single Showcase entry // Get some values $item_title = get_the_title($post->ID); $thumb = ac_resize_image_for_columns(array('image_id' => ac_get_post_thumbnail_id($post->ID), 'columns' => $column_count)); $a_start = "<a href='" . get_permalink($post->ID) . "' >"; $a_end = "</a>"; // Hide read more link on some post types $show_read_more = true; if ($post_type == 'ac_gallery') { $show_read_more = false; } elseif ($post_type == 'ac_person') { $show_read_more = false; } ?> <div class="ac-showcase-item" style="width:<?php echo $item_width; ?> "> <figure class='ac-hover-touch'> <?php // Thumbnail ?> <?php
<?php the_content(); ?> </div> <?php } else { // Images $images = ac_get_images_for_post(get_the_ID(), ac_get_meta('include_featured_image')); if (count($images)) { ?> <div class='post-images'> <?php foreach ($images as $image_id) { $a_start = ''; $a_end = ''; if ($lightbox_images) { $img = ac_resize_image_for_columns(array('image_id' => $image_id, 'columns' => 12, 'ratio' => AC_IMAGE_RATIO_PRESERVE)); $a_start = '<a class="prettyphoto" href="' . esc_url($img['url']) . '" rel="prettyPhoto[rel-' . ac_get_prettyphoto_rel() . ']"><div>'; $a_end = '</div></a>'; } echo $a_start; echo ac_render_image_for_columns(array('image_id' => $image_id, 'columns' => 7, 'ratio' => AC_IMAGE_RATIO_PRESERVE)); echo $a_end; } ?> </div> <?php } } ?> <div class='article-footer'> <?php
$a_start = ''; $a_end = ''; if (get_permalink($post->ID)) { $a_start = "<a href='" . get_permalink($post->ID) . "' "; // Check for extermal link if ($a_target_blank) { $a_start .= ' target="_blank" '; } $a_start .= " >"; $a_end = "</a>"; } $text_class = ''; // For attachment type (AC Gallery) use a lightbox if (get_post_type($post) == 'attachment') { // For image use lightbox $img = ac_resize_image_for_columns(array('image_id' => $post->ID, 'columns' => 12)); // Don't include the pretty photo data in the text link $a_start = '<a class="prettyphoto" href="' . esc_url($img['url']) . '" rel="prettyPhoto[rel-' . ac_get_prettyphoto_rel() . ']">'; } // Post type specifics // Add hover title class for some posts if (in_array($post_type, array('ac_portfolio', 'ac_gallery', 'attachment'))) { $text_class = ' title-hover '; } ?> <div class="ac-carousel-content <?php echo $text_class; ?> "> <?php
function ac_resize_image_for_grid($args) { // Defaults $defaults = array("image_id" => null, "columns" => null, "ratio" => AC_IMAGE_RATIO_3BY2); $args = wp_parse_args($args, $defaults); extract($args); // Resize $image = ac_resize_image_for_columns($args); // Return HTML return '<img class="grid-image" src="' . $image['url'] . '" alt="' . esc_attr(ac_get_image_alt($image_id)) . '" />'; }
function ac_render_royalslider_from_posts($posts, $args) { // RoyalSlider expects content in the RS HTML Structure, so do nothing if no posts if (empty($posts)) { return; } global $post; // Defaults $auto_height = false; // Params to variables extract($args); // $post_parent is the gallery id // hide_titles is a gallery setting $hide_titles = false; // Default to true for Easy Slider, general use if (isset($post_parent)) { $hide_titles = get_post_meta($post_parent, 'hide-titles', true); } // Ensure proper boolean $hide_titles = filter_var($hide_titles, FILTER_VALIDATE_BOOLEAN); // Get the slideshow settings from the Options $autoplay = ac_bool_to_string(shoestrap_getVariable('aeis_autoplay')); $transition = shoestrap_getVariable('aeis_transition'); $delay = shoestrap_getVariable('aeis_slideshow_delay'); if ($delay) { $delay = $delay * 1000; // miliseconds } else { $delay = 5000; } $rs_split_nav = false; // Check if no click by nav defined if (defined('AC_RS_SPLIT_NAV')) { $rs_split_nav = true; } // Classes $classes = ''; if ($slider_size == 'letterbox') { $classes = 'ac-full-width-row'; } if (isset($args['class'])) { $classes .= ' ' . $args['class'] . ' '; } ?> <div class="ac-royalSlider sliderContainer fullWidth clearfix <?php echo $classes; ?> <?php echo $slider_style; ?> <?php echo $slider_size; ?> " data-show-title="<?php echo $show_title; ?> " data-show-excerpt="<?php echo $show_excerpt; ?> " data-slider-size="<?php echo $slider_size; ?> " data-delay="<?php echo $delay; ?> " data-autoplay="<?php echo $autoplay; ?> " data-transition="<?php echo $transition; ?> " data-split-nav="<?php echo $rs_split_nav; ?> " data-auto-height="<?php echo json_encode($auto_height); ?> "> <div class="royalSlider heroSlider rsMinW full-width-slider"> <?php // Render each image if ($posts) { foreach ($posts as $post) { setup_postdata($post); // Links $a_start = ''; $a_end = ''; // Only add links for the slider-posts. Gallery shouldn't click through if ($slider_style == 'slider-post') { $a_start = "<a href='" . get_permalink($post->ID) . "'>"; $a_end = "</a>"; } // Get the post type $post_type = get_post_type($post); // For testimonials write out the HTML if ($post_type == 'ac_testimonial') { ?> <div class="rsContent"> <?php echo ac_testimonial_render($post->ID); ?> </div> <?php } else { // Other post types // Get the image ID. Some are featured image, some are the actualy post $image_id = ac_get_post_thumbnail_id($post); // Resize differently for different scenarios if ($slider_size == 'nearby') { $img = ac_resize_image_for_height(array('height' => 495, 'ratio' => AC_IMAGE_RATIO_PRESERVE)); $img_args = array('image_id' => $image_id, 'columns' => 1, 'ratio' => AC_IMAGE_RATIO_PRESERVE, 'ensure_min_width' => false); } else { $img_args = array('image_id' => $image_id, 'columns' => 12, 'ratio' => AC_IMAGE_RATIO_PRESERVE, 'full_width' => $full_width); $img = ac_resize_image_for_columns($img_args); } // For nearby images we set the data width and height $rsw = ''; $rsh = ''; if ($slider_size == 'nearby') { $rsw = ' data-rsw="' . $img['width'] . '" '; $rsh = ' data-rsh="495" '; } // Check if the titles are required $title = ''; $content = ''; if ($hide_titles !== true) { // Get the title $title = $a_start . get_the_title() . $a_end; // Get the content $content = $post->post_content; $content = apply_filters('the_excerpt', $content); // Use the_excerpt as the_content returns the actual image in the content $content = str_replace('//]]>', ']]>', $content); $content = "<div class='excerpt'>" . $content . "</div>"; $content = $a_start . ac_person_get_position() . $content . $a_end; } ?> <div class="rsContent"> <img class="rsImg" <?php echo $rsw; ?> <?php echo $rsh; ?> src="<?php echo $img['url']; ?> " alt="<?php esc_attr(the_title()); ?> " /> <div class="infoBlock infoBlockLeftBlack rsABlock" data-fade-effect="" data-move-offset="10" data-move-effect="bottom" data-speed="200"> <div class="caption"><?php echo $title; ?> </div> <div class="description"><?php echo $content; ?> </div> </div> </div> <?php } ?> <?php } // image wp_reset_postdata(); } ?> </div> <!--Control Bar--> <div class='ac-rs-overlay'></div> <div class="ac-rs-controls-wrapper load-item"> <!-- Caption --> <div class="slidecaption"></div> <!-- Description --> <div class="slidedescription"></div> </div> </div> <?php }
case 'large': $img_cols = $img_cols * 2; break; case 'landscape': $img_cols = $img_cols * 2; $img_height_style = AC_IMAGE_RATIO_1BY2; break; case 'tall': $img_height_style = AC_IMAGE_RATIO_2BY1; break; } } } else { if (get_post_type($post) == 'attachment') { // For image use lightbox $img = ac_resize_image_for_columns(array('image_id' => $post->ID, 'columns' => 12, 'ratio' => ac_get_height_style_for_post($post->ID))); // Don't include the pretty photo data in the text link $a_start = '<a class="prettyphoto" href="' . esc_url($img['url']) . '" rel="prettyPhoto[rel-' . ac_get_prettyphoto_rel() . ']">'; } } } // Image if (ac_has_post_thumbnail($post->ID)) { $img_args = array('image_id' => ac_get_post_thumbnail_id($post->ID), 'columns' => $img_cols, 'ratio' => $img_height_style, 'full_width' => $full_width); $image = ac_resize_image_for_grid($img_args); } // Excerpt if ($show_excerpt) { // Sanitise some values $excerpt_length = false; $excerpt = ac_get_excerpt($post, $excerpt_length, false, true);