function delicious_portfolio_grid($atts, $content = null) { extract(shortcode_atts(array("number" => "-1", "categories" => "", "allword" => "All", "initial_word" => "", "allbam" => ""), $atts)); global $post; global $smof_data; //setting a random id $rnd_id = ''; if (function_exists('dt_random_id')) { $rnd_id = dt_random_id(3); } $token = wp_generate_password(5, false, false); wp_enqueue_script('dt-isotope'); wp_enqueue_script('dt-custom-isotope-portfolio'); wp_localize_script('dt-custom-isotope-portfolio', 'dt_grid_' . $token, array('id' => $rnd_id, 'initial_word' => $initial_word)); $layout = get_post_meta($post->ID, 'dt_portfolio_columns', true); $navig = get_post_meta($post->ID, 'dt_portfolio_navigation', true); $nav_number = get_post_meta($post->ID, 'dt_nav_number', true); $cats = explode(",", $categories); if (post_type_exists('portfolio')) { $portfolio_categs = get_terms('portfolio_cats', array('hide_empty' => false)); $categ_list = ''; foreach ($cats as $categ) { foreach ($portfolio_categs as $portfolio_categ) { if ($categ === $portfolio_categ->name) { $categ_list .= $portfolio_categ->slug . ', '; } } } //fallback categories $args = array('post_type' => 'portfolio', 'taxonomy' => 'portfolio_cats'); $categ_fall = get_categories($args); $categ_use = array(); $i = 0; foreach ($categ_fall as $cate) { $categ_use[$i] = $cate->name; $i++; } $cats = array_filter($cats); if (empty($cats)) { $cats = array_merge($cats, $categ_use); } $term_list = ''; $list = ''; foreach ($cats as $cat) { $to_replace = array(' ', '/', '&'); $intermediate_replace = strtolower(str_replace($to_replace, '-', $cat)); $str = preg_replace('/--+/', '-', $intermediate_replace); if (function_exists('icl_t')) { $term_list .= '<li><a href="#filter" data-option-value=".' . get_taxonomy_cat_ID($cat) . '">' . icl_t('Portfolio Category', 'Term ' . get_taxonomy_cat_ID($cat) . '', $cat) . '</a></li>'; } else { $term_list .= '<li><a href="#filter" data-option-value=".' . get_taxonomy_cat_ID($cat) . '">' . $cat . '</a></li>'; } $list .= $cat . ', '; } $output = ''; $output .= '<section class="patti-grid" id="gridwrapper_' . $rnd_id . '" data-token="' . $token . '">'; $output .= '<section id="options">'; $output .= '<ul id="filters" class="option-set clearfix" data-option-key="filter">'; if ($allbam == "") { $output .= '<li class="all-projects"><a href="#filter" data-option-value="*" class="selected active">' . $allword . '</a></li>'; $output .= $term_list; } else { $output .= $term_list; $output .= '<li class="all-projects"><a href="#filter" data-option-value="*" class="selected active">' . $allword . '</a></li>'; } $output .= '</ul>'; $output .= '</section>'; $output .= '<div class="space"></div>'; $output .= '<section id="portfolio-wrapper">'; $output .= '<ul class="portfolio grid isotope grid_' . $rnd_id . '">'; $args = array('post_type' => 'portfolio', 'posts_per_page' => $number, 'term' => 'portfolio_cats', 'portfolio_cats' => $categ_list); $my_query = new WP_Query($args); if ($my_query->have_posts()) { while ($my_query->have_posts()) { $my_query->the_post(); $terms = get_the_terms(get_the_ID(), 'portfolio_cats'); $term_val = ''; if ($terms) { foreach ($terms as $term) { $term_val .= get_taxonomy_cat_ID($term->name) . ' '; } } $portf_icon = get_post_meta($post->ID, 'dt_portf_icon', true); $portf_thumbnail = get_post_meta($post->ID, 'dt_portf_thumbnail', true); $portf_link = get_post_meta($post->ID, 'dt_portf_link', true); $portf_video = get_post_meta($post->ID, 'dt_portf_video', true); $lgal = get_post_meta($post->ID, 'dt_portf_gallery', true); $gal_output = ''; if (!empty($lgal)) { foreach ($lgal as $gal_item) { $gal_item_url = $gal_item['dt_gl_url']['url']; $gal_item_title = get_post($gal_item['dt_gl_url']['id'])->post_excerpt; $gal_output .= '<a class="hidden_image" href="' . $gal_item_url . '" rel="prettyPhoto[gallery_' . $post->ID . ']" title="' . $gal_item_title . '"></a>'; } } $thumb_id = get_post_thumbnail_id($post->ID); $alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true); $image_url = wp_get_attachment_url($thumb_id); $grid_thumbnail = $image_url; $item_class = 'item-small'; switch ($portf_thumbnail) { case 'portfolio-big': $grid_thumbnail = aq_resize($image_url, 762, 592, true); $item_class = 'item-wide'; break; case 'portfolio-small': $grid_thumbnail = aq_resize($image_url, 379, 295, true); $item_class = 'item-small'; break; case 'half-horizontal': $grid_thumbnail = aq_resize($image_url, 762, 295, true); $item_class = 'item-long'; break; case 'half-vertical': $grid_thumbnail = aq_resize($image_url, 379, 592, true); $item_class = 'item-high'; break; } $copy = $terms; $res = ''; if ($terms) { foreach ($terms as $term) { if (function_exists('icl_t')) { $res .= icl_t('Portfolio Category', 'Term ' . get_taxonomy_cat_ID($term->name) . '', $term->name); } else { $res .= $term->name; } if (next($copy)) { $res .= ', '; } } } // lazyload replacement $lazyrep = ''; if (isset($smof_data['lazyload']) && $smof_data['lazyload'] == '1') { $lazyrep = 'class="lazy" data-original'; } else { $lazyrep = 'src'; } $output .= '<li class="grid-item ' . $term_val . ' ' . $item_class . '">'; $inner_output = ''; $inner_output .= '<div class="grid-item-on-hover">'; $inner_output .= '<div class="grid-text">'; $inner_output .= '<h1>' . get_the_title() . '</h1>'; $inner_output .= '</div>'; $inner_output .= '<div><span>'; $inner_output .= $res; $inner_output .= '</span></div>'; $inner_output .= '</div>'; $inner_output .= '<img ' . $lazyrep . '="' . $grid_thumbnail . '" alt="' . $alt . '" />'; $test_link = ''; if ($portf_icon == 'link_to_page') { $test_link = '<a href="' . get_permalink($post->ID) . '">' . $inner_output . '</a>'; } else { if ($portf_icon == 'link_to_link') { $test_link = '<a href="' . $portf_link . '">' . $inner_output . '</a>'; } else { if ($portf_icon == 'lightbox_to_image') { $test_link = '<a href="' . wp_get_attachment_url($thumb_id) . '" rel="prettyPhoto[portf_gal]" title="' . get_the_title() . '">' . $inner_output . '</a>'; } else { if ($portf_icon == 'lightbox_to_video') { $test_link = '<a href="' . $portf_video . '" rel="prettyPhoto[portf_gal]" title="' . get_the_title() . '">' . $inner_output . '</a>'; } else { if ($portf_icon == 'lightbox_to_gallery') { $test_link = '<a href="' . wp_get_attachment_url($thumb_id) . '" rel="prettyPhoto[gallery_' . $post->ID . ']" title="' . get_post($thumb_id)->post_excerpt . '" >' . $inner_output . '</a>' . $gal_output; } } } } } $output .= $test_link; $output .= '</li>'; } } wp_reset_query(); $output .= '</ul>'; $output .= '</section>'; $output .= '</section>'; $output .= '<div class="space"></div>'; return $output; } }
} ?> <div class="grid-item-on-hover"> <div class="grid-text"> <h1><?php echo get_the_title(); ?> </h1> </div> <span> <?php $copy = $terms; foreach ($terms as $term) { if (function_exists('icl_t')) { echo icl_t('Portfolio Category', 'Term ' . get_taxonomy_cat_ID($term->name) . '', $term->name); } else { echo $term->name; } if (next($copy)) { echo ', '; } } ?> </span> </div> <img src="<?php echo $grid_thumbnail; ?> " alt="" /> </a>
// Social Block vc_map(array("name" => __("Social Block", "js_composer"), "icon" => get_template_directory_uri() . '/images/composer/share.png', "base" => "dt-social-block", "description" => "Sharing on social networks widget", "weight" => 16, "class" => "social_extended", "category" => __("Built for Patti", "js_composer"), "params" => array(array("type" => "textfield", "class" => "", "heading" => __("Title before the social block (optional)", "js_composer"), "param_name" => "title", "description" => __("If you want to set a title for the social block, add it above. Something like 'Share this post' will work very well. Icons included in the social block: twitter, facebook, pinterest, google+, delicious and linkedin.", "js_composer"))))); // Blog Post Grid $blog_cats = get_terms('category', array('hide_empty' => false)); $cats_array = array(); foreach ($blog_cats as $blog_cat) { $cats_array[$blog_cat->name] = $blog_cat->slug; } vc_map(array("name" => __("Blog Grid", "js_composer"), "icon" => get_template_directory_uri() . '/images/composer/newspaper_add.png', "base" => "dt-blog-grid", "weight" => 19, 'front_enqueue_js' => get_template_directory_uri() . '/js/custom/custom-isotope-blog.js', "description" => "Masonry layout for blog posts", "class" => "blog_grid_extended", "category" => __("Built for Patti", "js_composer"), "params" => array(array("type" => "textfield", "class" => "", "heading" => __("Number of Blog Posts to Display. Use '-1' to include all your items.", "js_composer"), "param_name" => "number", "value" => 10, "description" => __("Set how many blog items would you like to include in the grid. The grid is built using the masonry style.", "js_composer")), array("type" => "dropdown", "heading" => __("Grid Columns", "js_composer"), "param_name" => "columns", "admin_label" => true, "value" => array("1" => "1", "2" => "2", "3" => "3"), "description" => __("Select Blog grid columns.", "js_composer")), array("type" => "checkbox", "heading" => __("Select Categories", "js_composer"), "param_name" => "categories", "value" => $cats_array, "description" => __("Select from which categories to display blog posts(mandatory).", "js_composer"))))); // Portfolio Grid $portfolio_categs = get_terms('portfolio_cats', array('hide_empty' => false)); $portfolio_cats_array = array(); $dt_placebo = array('No Thanks!' => NULL); $term_vals = array(); foreach ($portfolio_categs as $portfolio_categ) { $term_vals[$portfolio_categ->name] = get_taxonomy_cat_ID($portfolio_categ->name); $portfolio_cats_array[$portfolio_categ->name] = $portfolio_categ->name; } $dt_initial_filter = $dt_placebo + $term_vals; vc_map(array("name" => __("Portfolio Grid", "js_composer"), "icon" => get_template_directory_uri() . '/images/composer/folder_picture.png', "base" => "dt-portfolio-grid", "description" => "Masonry grid layout for portfolio items", "weight" => 20, 'front_enqueue_js' => get_template_directory_uri() . '/js/custom/custom-isotope-portfolio.js', "class" => "portfolio_grid_extended", "category" => __("Built for Patti", "js_composer"), "params" => array(array("type" => "textfield", "class" => "", "admin_label" => true, "heading" => __("Number of Items to Display", "js_composer"), "param_name" => "number", "value" => 10, "description" => __("Set how many portfolio items would you like to include in the grid. Use '-1' to include all your items.", "js_composer")), array("type" => "checkbox", "class" => "", "heading" => __("Portfolio Categories", "js_composer"), "param_name" => "categories", "value" => $portfolio_cats_array, "description" => __("Select from which categories to display projects(mandatory).", "js_composer")), array("type" => "textfield", "heading" => __("Keyword for All Projects Filter", "js_composer"), "param_name" => "allword", "value" => "All", "description" => __("You can replace the default 'All' keyword for the initial filter with another one. If you want to hide it, you can do it with this CSS code: .all-projects { display: none !important; }", "js_composer")), array("type" => "dropdown", "heading" => __("'All' filter position.", "js_composer"), "param_name" => "allbam", "value" => array(__("At the beginning", "js_composer") => '', __("At the end", "js_composer") => 'on-the-end'), "description" => __("Set where the 'All' filter should be displayed: at the beginning or at the end of the filter list.", "js_composer")), array("type" => "dropdown", "heading" => __("Set Another Initial Filter", "js_composer"), "param_name" => "initial_word", "value" => $dt_initial_filter, "description" => __("You can set the portfolio grid to display projects from a certain category, on the initial state. If you want to reorder the categories, use <a href='http://goo.gl/kCYZ0L'>this plugin</a>", "js_composer"))))); // List styles vc_map(array("name" => __("List", "js_composer"), "icon" => get_template_directory_uri() . '/images/composer/text_list_bullets.png', "description" => "List element with icon style", "base" => "dt-list", "weight" => 15, "class" => "list_extended", "category" => __("Built for Patti", "js_composer"), "params" => array(array("type" => "textfield", "admin_label" => true, "class" => "", "heading" => __("Icon Name", "js_composer"), "param_name" => "icon", "value" => "check", "description" => __("Please set an icon for the custom list. The entire list of icons can be found at <a href='http://fortawesome.github.io/Font-Awesome/icons/' target='_blank'>FontAwesome project page</a>. For example, if an icon is named 'fa-angle-right', the value you have to add inside the field is 'angle-right'.", "js_composer")), array("type" => "textarea_html", "class" => "", "admin_label" => true, "heading" => __("List Rows", "js_composer"), "param_name" => "content", "value" => "<ul><li>Lorem ipsum</li><li>Consectetur adipisicing</li><li>Ullamco laboris</li><li>Quis nostrud exercitation</li>", "description" => __("Create your list using the WordPress default functionality.", "js_composer"))))); // Clients vc_map(array("name" => __("Clients Slider", "js_composer"), "icon" => get_template_directory_uri() . '/images/composer/tie.png', "base" => "dt-clients", "weight" => 14, "description" => "Slider for clients/partners logos", "class" => "clients_extended", "category" => __("Built for Patti", "js_composer"), "params" => array(array("type" => "attach_images", "class" => "", "admin_label" => true, "heading" => __("Upload Images", "js_composer"), "param_name" => "images", "value" => "", "description" => __("Upload the images for your clients.", "js_composer")), array("type" => "exploded_textarea", "class" => "", "heading" => __("Clients Links", "js_composer"), "param_name" => "links", "value" => "", "description" => __("Enter links for each client here. Divide links with linebreaks (Enter).", "js_composer")), array("type" => "textfield", "heading" => __("Image size(Optional)", "js_composer"), "param_name" => "thumb_size", "description" => __("Enter image size. Example: thumbnail, medium, large, full. Alternatively enter image size in pixels: 200x100 (Width x Height). Leave empty to use 'thumbnail' size. Recommended: full", "js_composer"))))); // Progress Bar vc_map(array("name" => __("Progress Bar", "js_composer"), "base" => "dt-skillbar", "weight" => 16, "description" => "Display your skills with style", "icon" => get_template_directory_uri() . '/images/composer/progressbar.png', "class" => "skillbar_extended", 'front_enqueue_js' => get_template_directory_uri() . '/js/waypoints.min.js', "category" => __("Built for Patti", "js_composer"), "params" => array(array("type" => "exploded_textarea", "class" => "", "admin_label" => true, "heading" => __("Graphic values", "js_composer"), "param_name" => "values", "value" => "90|Development", "description" => __("Input graph values here. Divide values with linebreaks (Enter). Example: 90|Development.", "js_composer")), array("type" => "textfield", "class" => "", "heading" => __("Units", "js_composer"), "param_name" => "units", "value" => "%", "description" => __("Enter measurement units (if needed) Eg. %, px, points, etc. Graph value and unit will be appended to the graph title.", "js_composer"))))); // Portfolio Slider vc_map(array("name" => __("Project Image Slider", "js_composer"), "base" => "dt-portfolio-slider", "weight" => 18, "icon" => get_template_directory_uri() . '/images/composer/photos.png', "description" => "Gallery with style", "class" => "project_slider_extended", "category" => __("Built for Patti", "js_composer"), "params" => array(array("type" => "attach_images", "class" => "", "admin_label" => true, "heading" => __("Upload Images", "js_composer"), "param_name" => "images", "value" => "", "description" => __("Upload your images for the slider.", "js_composer")), array("type" => "textfield", "heading" => __("Image size(Optional)", "js_composer"), "param_name" => "thumb_size", "description" => __("Enter image size. Example: thumbnail, medium, large, full. Alternatively enter image size in pixels: 200x100 (Width x Height). Leave empty to use 'thumbnail' size. Recommended: full", "js_composer"))))); // Buttons vc_map(array("name" => __("Patti Button", "js_composer"), "base" => "dt-button", "weight" => 10, "icon" => get_template_directory_uri() . '/images/composer/button_default.png', "description" => "Eye catching button", "class" => "buttons_extended", "category" => __("Built for Patti", "js_composer"), "params" => array(array("type" => "textfield", "admin_label" => true, "heading" => __("Text on the button", "js_composer"), "param_name" => "text", "value" => "Button Text", "description" => __("Text on the button.", "js_composer")), array("type" => "textfield", "heading" => __("URL(Link)", "js_composer"), "param_name" => "url", "description" => __("Button Link.", "js_composer")), array("type" => "dropdown", "heading" => __("Color", "js_composer"), "admin_label" => true, "param_name" => "color", "value" => array(__("Orange", "js_composer") => 'orange', __("Yellow", "js_composer") => "yellow", __("Green", "js_composer") => "green", __("Blue", "js_composer") => "bleumarin", __("Rose", "js_composer") => "rose", __("Black", "js_composer") => "black", __("Red", "js_composer") => "red", __("Gray", "js_composer") => "gray"), "description" => __("Button color.", "js_composer")), array("type" => "dropdown", "heading" => __("Size", "js_composer"), "param_name" => "size", "value" => array(__("Regular", "js_composer") => '', __("Large", "js_composer") => "big"), "description" => __("Button Size.", "js_composer")), array("type" => "dropdown", "heading" => __("Style", "js_composer"), "param_name" => "style", "value" => array(__("Bold - Solid button", "js_composer") => '', __("Thin - Border only", "js_composer") => "alt"), "description" => __("Button Style.", "js_composer")), array("type" => "dropdown", "heading" => __("Target", "js_composer"), "param_name" => "target", "value" => array(__("Opens the link in the same window", "js_composer") => '', __("Opens the link in a new window", "js_composer") => "yes"), "description" => __("Set the target of the button.", "js_composer")), array("type" => "textfield", "heading" => __("Icon", "js_composer"), "param_name" => "icon", "description" => __("You can use icons from FontAwesome for the button. Visit the <a href='http://fontawesome.io/icons/'>Icons List</a> and grab the name of the icon you want to display. Ex: fa-bolt", "js_composer")), array("type" => "dropdown", "heading" => __("Icon Position", "js_composer"), "param_name" => "icon_right", "value" => array(__("Icon on left", "") => '', __("Icon on right", "js_composer") => "icon_right"), "description" => __("Display the icon on left or right side of button text.", "js_composer"), "dependency" => array('element' => "icon", 'not_empty' => true))))); // Text with Icon