/** * Gallery shortcode * * Will overwrite the default gallery shortcode * * @param array $atts * @param string $content * @return string */ function wolf_shortcode_images_gallery($atts, $content = null) { if (class_exists('Vc_Manager') && function_exists('vc_map_get_attributes')) { $atts = vc_map_get_attributes('wolf_images_gallery', $atts); } extract(shortcode_atts(array('ids' => '', 'layout' => 'simple', 'columns' => '3', 'size' => 'classic-thumb', 'link' => 'attachment', 'padding' => 'no', 'hover_effect' => 'default', 'orderby' => '', 'inline_style' => '', 'class' => ''), $atts)); $images = explode(',', $ids); $size = 'thumbnail' == $size ? 'classic-thumb' : $size; $size = wolf_get_image_size($size); if (wolf_is_blog() || wolf_is_portfolio()) { $output = wolf_flexslider_gallery($images, $orderby); } else { if ('carousel_mosaic' == $layout || 'mosaic' == $layout) { $carousel = $layout == 'carousel_mosaic' ? true : false; $output = wolf_mosaic_gallery($images, $link, $hover_effect, $orderby, $carousel, $inline_style, $class); } elseif ('carousel_simple' == $layout) { $output = wolf_simple_carousel_gallery($images, $link, $size, $padding, $hover_effect, $orderby, $inline_style, $class); } elseif ('simple' == $layout) { $output = wolf_simple_gallery($images, $link, $size, $padding, $columns, $hover_effect, $orderby, $inline_style, $class); } elseif ('masonry' == $layout) { $output = wolf_albums_gallery($images, $orderby, $inline_style, $class); } } return $output; }
<?php /** * The Last posts carousel shortcode */ $format = get_post_format() ? get_post_format() : 'standard'; $thumb_size = wolf_get_image_size('classic-thumb'); ?> <article <?php post_class('clearfix'); ?> id="post-<?php the_ID(); ?> " data-post-id="<?php the_ID(); ?> "> <div class="entry-thumbnail"> <?php the_post_thumbnail($thumb_size); ?> </div> <h3 class="entry-title"> <?php wolf_entry_title(true, false, true); ?> </h3> <div class="entry-meta"> <?php wolf_post_entry_meta();
/** * Last works_custom shortcode * * @param array $atts * @param string $content * @param string $post_type * @return string */ function wolf_last_post_types_custom_shortcode($atts, $content = null, $post_type) { if (class_exists('Vc_Manager') && function_exists('vc_map_get_attributes')) { //$atts = vc_map_get_attributes( 'wolf_last_photos_widget', $atts ); } extract(shortcode_atts(array('count' => 4, 'category' => null, 'col' => '4', 'layout' => 'classic', 'padding' => 'no', 'carousel' => '', 'label' => null, 'band' => null, 'animation' => null), $atts)); $layout = wolf_get_image_size($layout); $post_type = str_replace('wolf_last_posts_', '', $post_type); $col = absint($col); $class = "shortcode-{$post_type}-grid shortcode-items-grid {$post_type}-grid-col-{$col} {$post_type}-{$layout}"; if ($animation) { $class .= " wow {$animation}"; } if ('modern' == $layout) { $carousel = false; } if ('yes' == $carousel && 'work' == $post_type) { $class .= " works-carousel"; } if ('yes' == $carousel && 'release' == $post_type) { $class .= " releases-carousel"; } if ('no' == $padding) { $class .= " {$post_type}-no-padding"; } if ('release' == $post_type) { $layout = 'grid'; $carousel = false; } ob_start(); $args = array('post_type' => $post_type, 'posts_per_page' => absint($count), 'meta_query' => array(array('key' => '_thumbnail_id', 'compare' => '!=', 'value' => 'NULL'))); if (wolf_get_theme_option($post_type . '_reorder')) { $args['order'] = 'DESC'; $args['meta_key'] = '_position'; $args['orderby'] = 'meta_value_num'; } if ('release' == $post_type) { if ($label) { $args['label'] = $label; } if ($band) { $args['band'] = $band; } } if ($category) { $args[$post_type . '_type'] = $category; } $loop = new WP_Query($args); if ($loop->have_posts()) { ?> <div class="<?php echo esc_attr($class); ?> "> <?php while ($loop->have_posts()) { $loop->the_post(); if ('work' == $post_type) { wolf_portfolio_get_template_part('content', 'work-' . $layout); } elseif ('release' == $post_type) { get_template_part('wolf-discography/content', 'release-shortcode'); } elseif ('video' == $post_type) { get_template_part('wolf-videos/content', 'video-shortcode'); } else { get_template_part('wolf-' . $post_type . '/content', $post_type); } } ?> </div><!-- .shortcode-works-grid --> <?php } else { // no work ?> <p class="text-center"><?php __('No post found', 'wolf'); ?> </p> <?php } wp_reset_postdata(); $output = ob_get_contents(); ob_end_clean(); return $output; }
/** * Woocommerce mosaic category shortcode * * @param array $atts * @return string */ function wolf_woocommerce_categories_shortcode($atts) { if (class_exists('Vc_Manager') && function_exists('vc_map_get_attributes')) { $atts = vc_map_get_attributes('wolf_woocommerce_categories', $atts); } extract(shortcode_atts(array('layout' => 'classic-thumb', 'columns' => 3, 'padding' => 'yes', 'exclude' => '', 'include' => ''), $atts)); $padding = sanitize_text_field($padding); $exclude = sanitize_text_field($exclude); $include = sanitize_text_field($include); $layout = sanitize_text_field(wolf_get_image_size($layout)); $columns = absint($columns); $include_ids = array(); if ('' != $include) { $include = explode(',', str_replace(' ', '', $include)); foreach ($include as $slug) { $cat = get_term_by('slug', $slug, 'product_cat'); $include_ids[] = $cat->term_id; } } $exclude_ids = array(); if ('' != $exclude) { $exclude = explode(',', str_replace(' ', '', $exclude)); foreach ($exclude as $slug) { $cat = get_term_by('slug', $slug, 'product_cat'); $exclude_ids[] = $cat->term_id; } } $output = ''; include_once WC()->plugin_path() . '/includes/walkers/class-product-cat-list-walker.php'; $cats_args = array('taxonomy' => 'product_cat', 'parent' => 0, 'show_count' => 0, 'pad_counts' => 0, 'hide_empty' => 1, 'title_li' => '', 'menu_order' => 'asc', 'walker' => new WC_Product_Cat_List_Walker()); if ('' != $include) { $cats_args['include'] = $include_ids; } if ('' != $exclude) { $cats_args['exclude'] = $exclude_ids; } $cats = get_categories($cats_args); if (array() != $cats) { $rand_id = rand(0, 999); $selector = "shop-categories-{$rand_id}"; if ('mosaic' == $layout) { $output .= "<div class='mosaic-shop-categories-container' id='{$selector}'>"; } else { $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100 / $columns) : 100; $float = is_rtl() ? 'right' : 'left'; $css = "<style type='text/css'>\r\n\t\t\t\t\t#{$selector} .mosaic-shop-category{\r\n\t\t\t\t\t\tfloat: {$float};\r\n\t\t\t\t\t\twidth: {$itemwidth}%;\r\n\r\n\t\t\t\t"; if ('yes' == $padding) { $css .= "padding:1rem;"; } if (1 == $columns) { $css .= 'padding-bottom:10px!important;'; } $css .= '}</style>'; $output .= wolf_compact_css($css); $output .= "<div class='shop-categories-container' id='{$selector}'>"; } foreach ($cats as $cat) { $title = $cat->name; $thumbnail_id = get_woocommerce_term_meta($cat->term_id, 'thumbnail_id', true); $link = get_term_link($cat); $class = 'mosaic-shop-category product-cat'; $size = $layout; if ('mosaic' == $layout) { $size = get_woocommerce_term_meta($cat->term_id, 'thumbnail_size', true); if ('2x1' == $size) { $class .= ' width2 wide'; } elseif ('2x2' == $size) { $class .= ' width2 height2 big'; } } $img_url = wolf_get_url_from_attachment_id(absint($thumbnail_id), $size); if ($thumbnail_id) { $output .= "<div class='{$class}'>\r\n\t\t\t\t\t\t<figure class='effect-edouard'>\r\n\t\t\t\t\t\t\t<img src='{$img_url}'>\r\n\t\t\t\t\t\t\t<figcaption>\r\n\t\t\t\t\t\t\t\t<div class='figcaption-inner table'>\r\n\t\t\t\t\t\t\t\t\t<div class='table-cell' >\r\n\t\t\t\t\t\t\t\t\t\t<a href='{$link}' class='mask-link'></a>\r\n\t\t\t\t\t\t\t\t\t\t<h2 class='category-title'>{$title}</h2>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</figcaption>\r\n\t\t\t\t\t\t</figure>\r\n\t\t\t\t\t</div>"; } } // endforeach $output .= '</div>'; if ('mosaic' == $layout) { wp_enqueue_script('packery'); $output .= '<script type="text/javascript">jQuery(document).ready(function(){'; $output .= 'jQuery( ".mosaic-shop-categories-container" ).imagesLoaded( function() { jQuery( ".mosaic-shop-categories-container" ).isotope( { itemSelector : ".mosaic-shop-category", //animationEngine : "none", layoutMode: "packery" } ); });'; $output .= '});</script>'; } } // endif return $output; }
<?php if (!defined('ABSPATH')) { exit; } // Exit if accessed directly $post_id = get_the_ID(); $format = get_post_format() ? get_post_format() : 'standard'; $thumb_size = wolf_get_image_size('2x2'); if (has_post_thumbnail() && !post_password_required()) { ?> <article id="post-<?php the_ID(); ?> " <?php post_class(array('release-item-container')); ?> data-post-id="<?php the_ID(); ?> "> <figure class="effect-sadie"> <?php the_post_thumbnail($thumb_size); ?> <figcaption> <div class="figcaption-inner table"> <div class="table-cell" > <a href="<?php the_permalink(); ?>
/** * The Last posts slider shortcode */ ?> <li id="post-<?php the_ID(); ?> " <?php post_class(array('slide')); ?> data-post-id="<?php the_ID(); ?> "> <?php the_post_thumbnail(wolf_get_image_size('classic-thumb')); ?> <span class="slide-inner"> <h3><a href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a></h3> <div class="entry-meta"> <?php wolf_post_entry_meta(); ?> <?php edit_post_link(__('Edit', 'wolf'), '<span class="edit-link">', '</span>');