Ejemplo n.º 1
0
 /**
  * Start the element output.
  *
  * @see Walker::start_el()
  *
  * @since 3.0.0
  *
  * @param string $output Passed by reference. Used to append additional content.
  * @param object $item   Menu item data object.
  * @param int    $depth  Depth of menu item. Used for padding.
  * @param array  $args   An array of arguments. @see wp_nav_menu()
  * @param int    $id     Current item ID.
  */
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $indent = $depth ? str_repeat("\t", $depth) : '';
     // depth dependent classes
     $depth_classes = array($depth == 0 ? 'main-menu-item-top' : 'main-menu-item-sub', $depth >= 2 ? 'main-menu-item-sub-sub' : '', $depth % 2 ? 'menu-item-odd' : 'menu-item-even', 'menu-item-depth-' . $depth);
     $depth_class_names = ' ' . esc_attr(implode(' ', $depth_classes));
     $class_names = $value = $column_class = '';
     // ONLY CHECK ON LEVEL 1 SUBMENUS
     if ($depth == 1 && $this->mm_active) {
         $this->columns++;
         if ($this->childrens_count > $this->max_columns) {
             // CHECK IF WE HAVE MORE COLUMNS THAN THE MAX COLUMNS
             if ($this->columns > $this->max_columns) {
                 $output .= "\n</ul><ul class=\"zn_mega_row_start\">\n";
                 if ($this->childrens_count - $this->max_columns < $this->childrens_count) {
                     $column_class = zn_get_col_size($this->max_columns);
                 } else {
                     $column_class = zn_get_col_size($this->childrens_count - $this->max_columns);
                 }
                 $this->columns = 1;
             } else {
                 $column_class = zn_get_col_size($this->max_columns);
             }
         } else {
             $column_class = zn_get_col_size($this->childrens_count);
         }
     }
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $classes[] = 'menu-item-' . $item->ID;
     // Added mega menu class to parent li
     if ($depth === 0 && $this->mm_active) {
         $classes[] = 'menu-item-mega-parent';
     }
     $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
     $class_names = ' class="main-menu-item ' . esc_attr($class_names) . ' ' . $column_class . $depth_class_names . '"';
     $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args);
     $id = $id ? ' id="' . esc_attr($id) . '"' : '';
     $output .= $indent . '<li' . $id . $value . $class_names . '>';
     $atts = array();
     $atts['title'] = !empty($item->attr_title) ? $item->attr_title : '';
     $atts['target'] = !empty($item->target) ? $item->target : '';
     $atts['rel'] = !empty($item->xfn) ? $item->xfn : '';
     $atts['href'] = !empty($item->url) ? $item->url : '';
     $atts['class'] = !empty($item->class) ? $item->class : '';
     $atts['class'] .= ' main-menu-link ' . ($depth > 0 ? 'main-menu-link-sub' : 'main-menu-link-top');
     // STYLE THE SUBMENU TITLES
     if ($depth == 1 && $this->mm_active) {
         $atts['class'] .= ' zn_mega_title ';
     }
     if ($depth == 1 && $this->mm_active && get_post_meta($item->ID, '_menu_item_zn_mega_menu_headers', true)) {
         $atts['class'] .= ' zn_mega_title_hide ';
     }
     $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args);
     $attributes = '';
     foreach ($atts as $attr => $value) {
         if (!empty($value)) {
             $value = 'href' === $attr ? esc_url($value) : esc_attr($value);
             $attributes .= ' ' . $attr . '="' . $value . '"';
         }
     }
     // SHOW BADGE
     // LABEL
     $key = 'menu_item_zn_mega_menu_label';
     $badge_text = get_post_meta($item->ID, '_' . $key, true);
     $item_output = $args->before;
     $item_output .= '<a' . $attributes . '>';
     /** This filter is documented in wp-includes/post-template.php */
     $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
     $item_output .= !empty($badge_text) ? '<span class="zn-mega-new-item">' . $badge_text . '</span>' : '';
     $item_output .= '</a>';
     $item_output .= $args->after;
     /**
      * Filter a menu item's starting output.
      *
      * The menu item's starting output only includes $args->before, the opening <a>,
      * the menu item's title, the closing </a>, and $args->after. Currently, there is
      * no filter for modifying the opening and closing <li> for a menu item.
      *
      * @since 3.0.0
      *
      * @param string $item_output The menu item's starting HTML output.
      * @param object $item        Menu item data object.
      * @param int    $depth       Depth of menu item. Used for padding.
      * @param array  $args        An array of arguments. @see wp_nav_menu()
      */
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
 }
    function element()
    {
        global $zn_config;
        $separator_top = $this->opt('show_oblique_top') ? $this->opt('show_oblique_top') : 'yes';
        $sort_alphabetical = $this->opt('sort_alphabetical') ? $this->opt('sort_alphabetical') : '';
        $data_sort = $sort_alphabetical === 'yes' ? 'data-sort="h3 a"' : '';
        $separator_top = zn_get_top_separator(array('show' => $separator_top));
        $category = $this->opt('category') ? $this->opt('category') : '0';
        $posts_per_page = $this->opt('post_per_page') ? $this->opt('post_per_page') : '8';
        // How many posts to load
        $columns_num = $this->opt('columns_num') ? $this->opt('columns_num') : '3';
        $zn_config['columns'] = zn_get_col_size($columns_num);
        $zn_config['archive_type'] = $archive_type = false;
        $zn_config['pagination'] = $this->opt('use_pagination');
        $zn_config['use_as_gallery'] = $this->opt('use_as_gallery') === 'yes' ? true : false;
        $portfolio_icon_opt = zget_option('portfolio_archive_icon', 'portfolio_options');
        $portfolio_icon = !empty($portfolio_icon_opt['family']) ? '<div class="sectionIcon " ' . zn_generate_icon($portfolio_icon_opt) . '></div>' : '';
        ?>
			<section id="ZnPortfolio" class="obliqueCut <?php 
        echo $separator_top['class'];
        ?>
 <?php 
        echo $this->data['uid'];
        ?>
">
				<?php 
        echo $separator_top['svg'];
        //echo $portfolio_icon;
        //<div class="sectionIcon zn_icon icon_ribbon_alt"></div>
        ?>
		        <div class="container">

			<?php 
        $args = array('include' => $category, 'hide_empty' => true);
        $terms = $archive_type ? false : get_terms("portfolio_categories", $args);
        if (!empty($terms) && !is_wp_error($terms) && count($terms) > 1) {
            echo '<div class="row">';
            echo '<div class="col-sm-12">';
            echo '<div class="zn_portfolio_filter_container">';
            echo '<span class="filter_title h4 titleColor">' . __('Filter:', 'zn_framework') . '</span>';
            echo "<ul class='zn_portfolio_categories'>";
            echo '<li class="all"><a href="#" title="' . __('Alle', 'zn_framework') . '" data-filter="*" class="active">' . __('Alle', 'zn_framework') . '</a></li>';
            foreach ($terms as $term) {
                $term = sanitize_term($term, 'portfolio_categories');
                $term_link = get_term_link($term, 'portfolio_categories');
                // CHECK IF WE HAVE AN ERROR
                if (is_wp_error($term_link)) {
                    continue;
                }
                echo '/';
                echo '<li><a href="' . $term_link . '" title="' . $term->name . '" data-filter="' . $term->slug . '">' . $term->name . '</a></li>';
            }
            echo "</ul>";
            echo "</div>";
            echo "</div>";
            echo "</div>";
        }
        global $query_string, $paged;
        $tax_cat = '';
        if (!empty($category)) {
            $tax_cat = array(array('taxonomy' => 'portfolio_categories', 'field' => 'id', 'terms' => $category));
        }
        global $paged;
        $args = array('post_type' => 'portfolio', 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'tax_query' => $tax_cat, 'paged' => $paged);
        query_posts($args);
        ?>
		            <!-- START BLOG CONTENT -->
		            <div class="row">
		            
		                <!--MAIN COLUMN-->
		                <div class="zn_portfolio_archive col-sm-12" <?php 
        echo $data_sort;
        ?>
>
		                    <?php 
        get_template_part('template_helpers/loop', 'portfolio');
        wp_reset_query();
        ?>
		                </div>

		            </div>



		        </div>
			</section>
    		<!--END Portfolio archive section-->
		<?php 
    }
    function element()
    {
        global $post, $zn_framework;
        $columns_num = $this->opt('columns_num') ? $this->opt('columns_num') : '3';
        $columns_class = zn_get_col_size($columns_num);
        $underline = $this->opt('use_underline') !== 'zn_dummy_value' ? true : false;
        $title = $this->opt('title') ? '<span ' . ($underline ? 'class="underline"' : '') . '>' . $this->opt('title') . '</span>' : '';
        $title_style = $this->opt('title_style') ? $this->opt('title_style') : '';
        //** Appear animation
        $appear = $this->opt('appear_animation') ? 'data-appear="fade-in" data-appear-direction="' . $this->opt('appear_animation') . '" data-appear-delay="' . ($this->opt('appear_delay') ? $this->opt('appear_delay') : '0') . '"' : '';
        $portfolio_items = '';
        $tag_ids = wp_get_post_terms(zn_get_the_id(), 'portfolio_tags', array('fields' => 'ids'));
        if ($tag_ids) {
            $args = array('post_type' => 'portfolio', 'posts_per_page' => $columns_num, 'post__not_in' => array(zn_get_the_id()), 'tax_query' => array(array('taxonomy' => 'portfolio_tags', 'field' => 'id', 'terms' => $tag_ids, 'operator' => 'IN')));
            $portfolio_items = get_posts($args);
        }
        ?>

            <div class="znPortfolioRelated noTouch <?php 
        echo $this->data['uid'];
        ?>
" <?php 
        echo $appear;
        ?>
>
				
				<?php 
        echo '<h3 class="zn_title sectionTitle h1 ' . $title_style . ' ">' . $title . '</h3>';
        ?>

				<?php 
        if (empty($portfolio_items) && $zn_framework->pagebuilder->is_pb_edit) {
            echo '<div class="zn-pb-notification">It seems that there are no related items</div>';
            return;
        } elseif (empty($portfolio_items)) {
            _e('No related items found', 'zn_framework');
            echo '</div>';
            // CLOSING DIV
            return;
        }
        ?>

				<div class="row">
					<div class="smallScreenSliderContainer">
						<span class="Prev animate"><img alt="Previous" width="50" height="90" src="<?php 
        echo THEME_BASE_URI;
        ?>
/images/prevDark.png" /></span>
						<span class="Next animate"><img alt="Next" width="50" height="90" src="<?php 
        echo THEME_BASE_URI;
        ?>
/images/nextDark.png" /></span>
					</div>
					<div class="cloneOnSmallScreens">
				<?php 
        foreach ($portfolio_items as $post) {
            setup_postdata($post);
            ?>

							<!--PORTFOLIO ITEM-->
							<div class="<?php 
            echo $columns_class;
            ?>
">
								<?php 
            // FEATURED IMAGE
            if (has_post_thumbnail()) {
                $image = zn_get_post_image($post->ID, 370, 470, array('class' => 'img-responsive animate'));
                echo '<a class="scaleRotateImg portfolio_image" href="' . get_permalink() . '" title="' . get_the_title() . '">' . $image . '</a>';
            }
            ?>
							</div>
		                    <!--END PORTFOLIO ITEM-->
						<?php 
        }
        wp_reset_query();
        ?>
					</div>
            	</div>
            </div>
	<?php 
    }