Example #1
0
function nm_shortcode_nm_lightbox($atts, $content = NULL)
{
    nm_add_page_include('lightbox');
    extract(shortcode_atts(array('link_type' => 'link', 'title' => 'View', 'button_style' => 'filled', 'button_align' => 'center', 'button_size' => 'lg', 'button_color' => '', 'link_image_id' => '', 'content_type' => 'image', 'content_image_id' => '', 'content_url' => ''), $atts));
    // Text/Button/Image
    if ($link_type == 'btn') {
        $shortcode_params = 'link="url:%23" title="' . esc_attr($title) . '" align="' . esc_attr($button_align) . '" size="' . esc_attr($button_size) . '" style="' . esc_attr($button_style) . '"';
        $shortcode_params .= strlen($button_color) > 0 ? ' color="' . $button_color . '"' : '';
        $link = do_shortcode('[nm_button ' . $shortcode_params . ']');
    } else {
        if ($link_type == 'image') {
            $image_src = wp_get_attachment_image_src($link_image_id, 'full');
            $image_title = get_the_title($link_image_id);
            $link_icon = $content_type == 'iframe' ? '<i class="nm-font nm-font-play-filled"></i>' : '';
            $link = '
				<img src="' . esc_url($image_src[0]) . '" alt="' . esc_attr($image_title) . '" />' . $link_icon . '
				<div class="nm-image-overlay"></div>
			';
        } else {
            $link = '<a href="#">' . esc_attr($title) . '</a>';
        }
    }
    // Content
    if ($content_type != 'image') {
        $data_attr = 'data-mfp-src="' . esc_url($content_url) . '"';
    } else {
        $image_src = wp_get_attachment_image_src($content_image_id, 'full');
        $data_attr = 'data-mfp-src="' . esc_url($image_src[0]) . '"';
    }
    return '
			<div class="nm-lightbox" data-mfp-type="' . esc_attr($content_type) . '" ' . $data_attr . '>' . $link . '
			</div>';
}
function nm_shortcode_banner_slider($atts, $content = NULL)
{
    nm_add_page_include('banner-slider');
    extract(shortcode_atts(array('slider_type' => 'boxed', 'adaptive_height' => '', 'arrows' => '', 'pagination' => '', 'pagination_color' => 'gray', 'infinite' => '', 'autoplay' => '', 'background_color' => ''), $atts));
    $slider_class = 'nm-banner-slider slider-type-' . esc_attr($slider_type) . ' slick-slider slick-controls-' . esc_attr($pagination_color);
    $slider_settings_data = ' ';
    // Adaptive Height
    if (strlen($adaptive_height) > 0) {
        $slider_settings_data .= 'data-adaptive-height="true" ';
    }
    // Arrows
    if (strlen($arrows) > 0) {
        $slider_settings_data .= 'data-arrows="true" ';
    }
    // Pagination
    if (strlen($pagination) > 0) {
        $slider_class .= ' slick-dots-inside';
        $slider_settings_data .= 'data-dots="true" ';
    } else {
        $slider_class .= ' slick-dots-disabled';
    }
    // Autoplay
    if (strlen($autoplay) > 0) {
        $slider_settings_data .= 'data-autoplay="true" data-autoplay-speed="' . intval($autoplay) . '" ';
    }
    // Infinite loop
    if (strlen($infinite) > 0) {
        $slider_settings_data .= 'data-infinite="true"';
    }
    // Background color
    $background_color_style = strlen($background_color) > 0 ? 'style="background-color: ' . esc_attr($background_color) . '"' : '';
    $output = '<div class="' . $slider_class . '"' . $slider_settings_data . $background_color_style . '>' . do_shortcode($content) . '</div>';
    return $output;
}
function nm_shortcode_contact_form_7($atts, $content = NULL)
{
    nm_add_page_include('contact-form-7');
    extract(shortcode_atts(array('title' => '', 'id' => ''), $atts));
    $title_attr = strlen($title) > 0 ? ' title="Contact form"' : '';
    $shortcode = '[contact-form-7 id="' . intval($id) . '"' . $title_attr . ']';
    return do_shortcode($shortcode);
}
function nm_shortcode_product_slider($atts, $content = NULL)
{
    global $nm_globals;
    $nm_globals['product_slider_loop'] = true;
    nm_add_page_include('product-slider');
    extract(shortcode_atts(array('shortcode' => 'recent_products', 'per_page' => '12', 'columns' => '4', 'orderby' => 'date', 'order' => 'desc'), $atts));
    $shortcode_string = '[' . $shortcode . ' per_page="' . intval($per_page) . '" columns="' . intval($columns) . '" orderby="' . $orderby . '" order="' . $order . '"]';
    return do_shortcode($shortcode_string);
    $nm_globals['product_slider_loop'] = false;
}
function nm_shortcode_product_categories($atts, $content = NULL)
{
    global $woocommerce_loop;
    // Columns (large column is set via shortcode attribute)
    $woocommerce_loop['columns_small'] = '1';
    $woocommerce_loop['columns_medium'] = '2';
    if (isset($atts['packery']) && $atts['packery'] === '1') {
        nm_add_page_include('product_categories');
        // Enqueue script
        wp_enqueue_script('packery', NM_THEME_URI . '/js/plugins/packery.pkgd.min.js', array(), '1.3.2', true);
        $packery_class = 'packery-enabled nm-loader';
    } else {
        $packery_class = '';
    }
    return '<div class="nm-product-categories ' . $packery_class . '">' . WC_Shortcodes::product_categories($atts) . '</div>';
}
Example #6
0
if (strlen($max_width) > 0) {
    $type = 'boxed nm-row-max-width';
    // Set type to "boxed" if max-width is set
    $row_style .= 'max-width:' . intval($max_width) . 'px;';
}
// Mininmum height
if (strlen($min_height) > 0) {
    $row_style .= ' min-height:' . intval($min_height) . 'px;';
}
// Row class
$row_class = 'nm-row nm-row-' . $type . ' ' . $el_class . vc_shortcode_custom_css_class($css, ' ');
// Video (YouTube) background
if (!empty($video_bg) && !empty($video_bg_url)) {
    // Disable parallax
    $parallax = '';
    nm_add_page_include('video-background');
    // Enqueue YouTube JavaScript API
    wp_enqueue_script('nm_youtube_iframe_api_js', 'https://www.youtube.com/iframe_api', array(), NM_THEME_VERSION, true);
    $row_class .= ' nm-row-video';
    $wrapper_atts[] = 'data-video-url="' . esc_url($video_bg_url) . '"';
}
// Parallax
if (!empty($parallax)) {
    $row_class .= ' nm-row-parallax nm-row-parallax-' . $parallax;
    // Parallax image
    if (!empty($parallax_image)) {
        $parallax_image_id = preg_replace('/[^\\d]/', '', $parallax_image);
        $parallax_image_src = wp_get_attachment_image_src($parallax_image_id, 'full');
        if (!empty($parallax_image_src[0])) {
            $parallax_image_src = $parallax_image_src[0];
        }
Example #7
0
function nm_shortcode_banner($atts, $content = NULL)
{
    nm_add_page_include('banner');
    extract(shortcode_atts(array('layout' => 'full', 'title' => '', 'subtitle' => '', 'title_size' => 'small', 'link_source' => 'custom', 'custom_link' => '', 'shop_link_title' => '', 'shop_link' => '', 'link_type' => 'banner_link', 'text_color_scheme' => 'dark', 'text_position' => 'h_center-v_center', 'text_alignment' => 'align_left', 'text_width' => '', 'text_padding' => '', 'text_animation' => '', 'image_id' => '', 'alt_image_id' => '', 'image_type' => 'fluid', 'height' => '', 'background_color' => ''), $atts));
    // Enqueue CSS animation styles
    wp_enqueue_style('animate', NM_THEME_URI . '/css/third-party/animate.css', array(), '1.0', 'all');
    // Centered content class
    $banner_class = $layout == 'boxed-full-parent' ? 'content-boxed full-width-parent ' : 'content-' . esc_attr($layout) . ' ';
    // Background color
    $background_color_style = strlen($background_color) > 0 ? 'background-color: ' . esc_attr($background_color) . ';' : '';
    // Image
    $image_output = '';
    if (strlen($image_id) > 0) {
        $image = wp_get_attachment_image_src($image_id, 'full');
        if ($image_type == 'fluid') {
            $height_style = '';
            // Remove the banner height if a regular image is used
            $banner_class .= 'image-type-fluid';
            $image_output .= '<img src="' . esc_url($image[0]) . '" />';
            if (strlen($alt_image_id) > 0) {
                $banner_class .= ' has-alt-image';
                $alt_image = wp_get_attachment_image_src($alt_image_id, 'full');
                $image_output .= '<img src="' . esc_url(NM_THEME_URI . '/img/transparent.gif') . '" class="nm-banner-alt-image img" data-src="' . esc_url($alt_image[0]) . '" />';
            }
        } else {
            // Image height style
            $height = intval($height);
            $height_style = $height > 0 ? 'height: ' . $height . 'px; ' : '';
            $banner_class .= 'image-type-css';
            $image_output .= '<div class="nm-banner-image" style="' . $height_style . 'background-image: url(' . esc_url($image[0]) . ');"></div>';
            if (strlen($alt_image_id) > 0) {
                $banner_class .= ' has-alt-image';
                $alt_image = wp_get_attachment_image_src($alt_image_id, 'full');
                $image_output .= '<div class="nm-banner-image nm-banner-alt-image" data-src="' . esc_url($alt_image[0]) . '" style="' . $height_style . '"></div>';
            }
        }
        $banner_height_style = '';
    } else {
        // No image class
        $banner_class .= 'image-type-none';
        // Banner height style
        $height = intval($height);
        $banner_height_style = $height > 0 ? 'height: ' . $height . 'px; ' : '';
    }
    // CSS animation
    if (strlen($text_animation) > 0) {
        $animation_class = ' animated';
        $animation_data = ' data-animate="' . esc_attr($text_animation) . '"';
    } else {
        $animation_class = '';
        $animation_data = '';
    }
    // Text-color class
    $banner_class .= ' text-color-' . $text_color_scheme;
    // Text
    $content_output = '';
    $content_output .= strlen($title) > 0 ? '<h2 class="' . esc_attr($title_size) . '">' . $title . '</h2>' : '';
    $content_output .= strlen($subtitle) > 0 ? '<h3 class="nm-alt-font">' . $subtitle . '</h3>' : '';
    // Link
    $link_is_custom = $link_source == 'custom' ? true : false;
    $link = $link_is_custom ? $custom_link : $shop_link;
    $banner_link_open_output = $banner_link_close_output = '';
    $link_class = '';
    if (strlen($link) > 0) {
        if ($link_is_custom) {
            $banner_link = vc_build_link($link);
        } else {
            $link_class = ' nm-banner-shop-link';
            $banner_link = array('title' => $shop_link_title, 'url' => htmlspecialchars($link));
        }
        if ($link_type === 'banner_link') {
            $banner_link_open_output = '<a href="' . esc_url($banner_link['url']) . '" class="nm-banner-link nm-banner-link-full' . $link_class . '">';
            $banner_link_close_output = '</a>';
        } else {
            $content_output .= '<a href="' . esc_url($banner_link['url']) . '" class="nm-banner-link' . $link_class . '">' . $banner_link['title'] . '</a>';
        }
    }
    // Display banner content?
    if (strlen($content_output) > 0) {
        // Text position array
        $text_position = explode('-', $text_position);
        // Text width
        $text_styles = '';
        $text_width = intval($text_width);
        if ($text_width > 0) {
            $text_styles = 'width: ' . $text_width . '%; ';
        }
        // Text padding
        if (strlen($text_padding) > 0) {
            $padding = intval($text_padding) . '% ';
            $padding_top = '0 ';
            $padding_bottom = '0 ';
            if ($text_position[1] === 'v_top') {
                $padding_top = $padding;
            } else {
                if ($text_position[1] === 'v_bottom') {
                    $padding_bottom = $padding;
                }
            }
            $text_styles .= 'padding: ' . $padding_top . $padding . $padding_bottom . $padding . ';';
        }
        // Content markup
        $content_output = '
				<div class="nm-banner-content">
					<div class="nm-banner-content-inner">
						<div class="nm-banner-text ' . $text_position[0] . ' ' . $text_position[1] . ' ' . $text_alignment . '" style="' . $text_styles . '">
							<div class="nm-banner-text-inner' . $animation_class . '"' . $animation_data . '>' . $content_output . '</div>
						</div>
					</div>
				</div>';
    }
    // Banner markup
    $banner_output = '
			<div class="nm-banner ' . $banner_class . '" style="' . $banner_height_style . $background_color_style . '">' . $banner_link_open_output . $image_output . $content_output . $banner_link_close_output . '
			</div>';
    return $banner_output;
}
Example #8
0
                        </div>
                                            
                        <?php 
    woocommerce_mini_cart();
    ?>
                    </div>
                </div>
            </div>
            <!-- /widget panel -->
            <?php 
}
?>
            
            <?php 
if ($nm_globals['login_popup'] && !is_user_logged_in() && !is_account_page()) {
    nm_add_page_include('login-popup');
    ?>
				<!-- login popup -->
                <div id="nm-login-popup-wrap" class="nm-login-popup-wrap mfp-hide">
                    <?php 
    wc_get_template('myaccount/form-login.php', array('is_popup' => true));
    ?>
				</div>
                <!-- /login popup -->
			<?php 
}
?>
            
            <!-- quickview -->
            <div id="nm-quickview" class="clearfix"></div>
            <!-- /quickview -->
/**
 * The template for displaying product content within loops.
 *
 * Override this template by copying it to yourtheme/woocommerce/content-product.php
 *
 * @author 	WooThemes
 * @package WooCommerce/Templates
 * @version 2.4.0
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
global $product, $woocommerce_loop, $nm_theme_options, $nm_globals;
nm_add_page_include('products');
// Action: woocommerce_before_shop_loop_item_title
remove_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
// Action: woocommerce_after_shop_loop_item_title
remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5);
// Store loop count we're currently on
if (empty($woocommerce_loop['loop'])) {
    $woocommerce_loop['loop'] = 0;
}
// Store column count for displaying the grid
if (empty($woocommerce_loop['columns'])) {
    $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', 4);
}
// Ensure visibility
if (!$product || !$product->is_visible()) {
    return;
function nm_shortcode_post_slider($atts, $content = NULL)
{
    nm_add_page_include('post-slider');
    extract(shortcode_atts(array('num_posts' => '8', 'category' => '', 'columns' => '4', 'image_type' => 'fluid', 'bg_image_height' => '', 'post_excerpt' => '0'), $atts));
    $args = array('post_status' => 'publish', 'post_type' => 'post', 'category_name' => $category, 'posts_per_page' => intval($num_posts));
    $posts = new WP_Query($args);
    $columns = intval($columns);
    $data_settings = 'data-slides-to-show="' . $columns . '" data-slides-to-scroll="' . $columns . '"';
    ob_start();
    if ($posts->have_posts()) {
        ?>
        <div class="nm-post-slider slick-slider slick-controls-gray slick-dots-centered slick-dots-active-small" <?php 
        echo $data_settings;
        ?>
>
			<?php 
        while ($posts->have_posts()) {
            $posts->the_post();
            ?>
            <div>
                <div class="nm-post-slider-inner">
                    <a href="<?php 
            esc_url(the_permalink());
            ?>
" class="nm-post-slider-image">
					<?php 
            if (has_post_thumbnail()) {
                $image_id = get_post_thumbnail_id();
                $image = wp_get_attachment_image_src($image_id, 'nm_large', true);
                $image_title = get_the_title($image_id);
                // Image HTML
                if ($image_type === 'fluid') {
                    echo '<img src="' . esc_url($image[0]) . '" alt="' . esc_attr($image_title) . '" />';
                } else {
                    $image_height_style = strlen($bg_image_height) > 0 ? 'height:' . intval($bg_image_height) . 'px; ' : '';
                    printf('<div class="bg-image" style="%sbackground-image:url(%s);"></div>', $image_height_style, $image[0]);
                }
                ?>
						<div class="nm-image-overlay"></div>
					<?php 
            } else {
                ?>
						<span class="nm-post-slider-noimage"></span>
					<?php 
            }
            ?>
                    </a>
                    
                    <div class="nm-post-slider-content">
                        <div class="nm-post-meta"><?php 
            the_time(get_option('date_format'));
            ?>
</div>
                        <h3><a href="<?php 
            esc_url(the_permalink());
            ?>
" class="dark"><?php 
            the_title();
            ?>
</a></h3>
                        <?php 
            if ($post_excerpt) {
                ?>
                        <div class="nm-post-slider-excerpt"><?php 
                esc_html(the_excerpt());
                ?>
</div>
                        <?php 
            }
            ?>
                    </div>
                </div>
            </div>
            <?php 
        }
        ?>
        </div>
        <?php 
    }
    wp_reset_query();
    $output = ob_get_clean();
    return $output;
}
Example #11
0
function nm_wp_gallery_set_include()
{
    nm_add_page_include('wp-gallery');
    return '';
    // Returning an empty string will output the default WP gallery
}