Esempio n. 1
0
        ?>

						<?php 
        /* Include the Post-Format-specific template for the content.
         * If you want to overload this in a child theme then include a file
         * called content-___.php (where ___ is the Post Format name) and that will be used instead.
         */
        get_template_part('content', get_post_format());
        ?>

					<?php 
    }
    ?>

					<?php 
    mega_pagination_content_nav('nav-pagination');
    ?>

				<?php 
} else {
    ?>

					<article id="post-0" class="post no-results not-found">
						<header class="entry-header">
							<h1 class="entry-title"><?php 
    _e('Nothing Found', 'mega');
    ?>
</h1>
						</header><!-- .entry-header -->

						<div class="entry-content">
Esempio n. 2
0
function mega_portfolio($atts, $content = null)
{
    wp_enqueue_script('isotope.pkgd.min');
    wp_enqueue_script('jquery.portfolio');
    extract(shortcode_atts(array('filter' => '', 'filter_align' => '', 'columns' => '4', 'number' => 12, 'grid_thumb_size' => 'large', 'meta_data' => '', 'text_align' => '', 'margin' => 20, 'full_width' => '', 'pagination' => '', 'style' => '1', 'category' => '', 'post_in' => '', 'post_not_in' => '', 'orderby' => 'date', 'order' => 'DESC', 'animation' => '', 'portfolio_50_width_enable' => '', 'css_class' => ''), $atts));
    if ($style == '2') {
        wp_enqueue_script('jquery.fancybox.pack');
    }
    //wp_enqueue_script( 'jquery.fancybox-media' );
    if ($columns == 3) {
        $portfolio_columns = 'col3';
    } elseif ($columns == 4) {
        $portfolio_columns = 'col4';
    } elseif ($columns == 2) {
        $portfolio_columns = 'col2';
    }
    if ($style == '2' || $style == '3' || $style == '4') {
        $portfolio_title_position_class = 'title-visible';
    } else {
        $portfolio_title_position_class = 'title-hidden';
    }
    if ($text_align == 'left') {
        $text_align_class = 'portfolio-text-left';
    } else {
        $text_align_class = 'portfolio-text-center';
    }
    if ($margin == 0) {
        $portfolio_margin = 'margin0';
    } else {
        $portfolio_margin = 'margin20';
    }
    if ($full_width != '' && $full_width != '0') {
        $portfolio_full_width_class = 'full-width';
    } else {
        $portfolio_full_width_class = 'default-width';
    }
    if ($pagination != '' && $pagination != '0') {
        $no_found_rows = false;
    } else {
        $no_found_rows = true;
    }
    if (get_query_var('paged')) {
        $paged = get_query_var('paged');
    } else {
        if (get_query_var('page')) {
            $paged = get_query_var('page');
        } else {
            $paged = 1;
        }
    }
    global $wp_query, $paged, $post;
    $temp = $wp_query;
    $wp_query = null;
    $args = array();
    $not_in = array();
    if ($post_not_in != '') {
        $post_not_in = str_ireplace(" ", "", $post_not_in);
        $not_in = explode(",", $post_not_in);
    }
    /*
    	if ( $post_in == '' ) {
    		global $post;
    		array_push($not_in, $post->ID);
    	}
    	else*/
    if ($post_in != '') {
        $post_in = str_ireplace(" ", "", $post_in);
        $args['post__in'] = explode(",", $post_in);
    }
    if ($post_in == '' || $post_not_in != '') {
        $args['post__not_in'] = $not_in;
    }
    if ($orderby != NULL) {
        $args['orderby'] = $orderby;
    }
    $args['order'] = $order;
    $args['post_type'] = 'portfolio';
    $args['portfolio-category'] = $category;
    $args['posts_per_page'] = $number;
    $args['paged'] = $paged;
    $args['no_found_rows'] = $no_found_rows;
    $args['post_status'] = 'publish';
    $wp_query = new WP_Query($args);
    ob_start();
    ?>
	
	<?php 
    if ($animation != '' && $animation != '0') {
        wp_enqueue_script('waypoints');
        $Animation = 'mt-animate_when_almost_visible-enabled';
    } else {
        $Animation = 'mt-animate_when_almost_visible-disabled';
    }
    ?>
	
	<?php 
    if ($portfolio_50_width_enable != '' && $portfolio_50_width_enable != '0') {
        $Portfolio_50_width_enable = 'portfolio-50-width-enabled';
    } else {
        $Portfolio_50_width_enable = 'portfolio-50-width-disabled';
    }
    ?>
	
	<div id="block-portfolio" class="<?php 
    echo sanitize_html_class($portfolio_full_width_class);
    ?>
 <?php 
    echo sanitize_html_class($css_class);
    ?>
 clearfix" data-columns="<?php 
    echo esc_attr($portfolio_columns);
    ?>
">
	
		<?php 
    if ($filter != '' && $filter != '0') {
        ?>
			<?php 
        if ($filter_align != '' && $filter_align != '0') {
            $filter_align_class = 'filter-center';
        } else {
            $filter_align_class = 'filter-left';
        }
        ?>
					
		<?php 
        $wp_list_categories = wp_list_categories(array('title_li' => '', 'show_option_none' => '', 'taxonomy' => 'portfolio-category', 'walker' => new Mega_Walker_Portfolio_Category(), 'orderby' => 'name', 'style' => 'none', 'echo' => 0));
        ?>
						
		<?php 
        if (!empty($wp_list_categories)) {
            ?>
						
			<nav id="filters" class="<?php 
            echo sanitize_html_class($portfolio_full_width_class);
            ?>
 <?php 
            echo sanitize_html_class($filter_align_class);
            ?>
 option-set">
				<div>
				<?php 
            $sep = '<span class="sep"></span>';
            ?>
				<?php 
            $wp_list_categories = str_replace('<br />', $sep, $wp_list_categories);
            ?>
				<a href="#" data-filter="*" class="selected"><?php 
            echo __('All', 'mega');
            ?>
</a>
				<?php 
            echo $sep;
            ?>
						
				
				<?php 
            if ($sep != '') {
                $wp_list_categories = strrev($wp_list_categories);
                $sep = strrev($sep);
                $wp_list_categories = explode($sep, $wp_list_categories, 2);
                $wp_list_categories = implode('', $wp_list_categories);
                $wp_list_categories = strrev($wp_list_categories);
            }
            ?>
	
												
				<?php 
            echo $wp_list_categories;
            ?>
				</div>
			</nav>
						
		<?php 
        }
        // End if ( ! empty( $wp_list_categories ) )
        ?>
						
	<?php 
    }
    // End if ($filter!='' && $filter!='0')
    ?>
	
		<div class="mt-loader spinner3"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>
		<div id="portfolio" class="<?php 
    echo sanitize_html_class($portfolio_columns);
    ?>
 <?php 
    echo sanitize_html_class($portfolio_title_position_class);
    ?>
 <?php 
    echo sanitize_html_class($text_align_class);
    ?>
 <?php 
    echo sanitize_html_class($portfolio_margin);
    ?>
 <?php 
    echo sanitize_html_class($Animation);
    ?>
 <?php 
    echo sanitize_html_class($Portfolio_50_width_enable);
    ?>
 clearfix">
		<div class="grid-sizer"></div>
		<div class="gutter-sizer"></div>
			<?php 
    if ($wp_query->have_posts()) {
        ?>
		
				<?php 
        while ($wp_query->have_posts()) {
            $wp_query->the_post();
            ?>
				
					<?php 
            $post_id = $wp_query->post->ID;
            $thumbnail = '';
            $post_thumbnail = $p_img_large = '';
            $post_thumbnail = wpb_getImageBySize(array('post_id' => $post_id, 'thumb_size' => $grid_thumb_size));
            $thumbnail = $post_thumbnail['thumbnail'];
            $p_img_large = $post_thumbnail['p_img_large'];
            ?>
					
					<?php 
            $portfolio_custom_url = get_post_meta(get_the_ID(), 'portfolio_custom_url', true);
            ?>
				
					<?php 
            if ($style == '2') {
                ?>
						
							<article id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class('clearfix');
                ?>
>
								<div class="content-wrapper">
									<?php 
                if ($thumbnail) {
                    ?>
										<div class="post-thumbnail clearfix">
										<?php 
                    $portfolio_highlight_text_color = get_post_meta(get_the_ID(), 'portfolio_highlight_text_color', true);
                    ?>
										<?php 
                    $portfolio_highlight_background_color = get_post_meta(get_the_ID(), 'portfolio_highlight_background_color', true);
                    ?>
										<?php 
                    $portfolio_image_lightbox = get_post_meta(get_the_ID(), 'portfolio_image_lightbox', true);
                    ?>
										<?php 
                    $rgb = mega_hex2rgb($portfolio_highlight_background_color);
                    ?>
										<?php 
                    $opacity = 0.8;
                    ?>
										<?php 
                    $rgba = "rgba(" . $rgb[0] . ", " . $rgb[1] . ", " . $rgb[2] . ", " . $opacity . ")";
                    ?>
												<?php 
                    echo $thumbnail;
                    ?>
												<div class="portfolio-view-wrapper">
													<div class="portfolio-bg" style="background-color: <?php 
                    echo esc_attr($portfolio_highlight_background_color);
                    ?>
; background-color: <?php 
                    echo esc_attr($rgba);
                    ?>
; color: <?php 
                    echo esc_attr($portfolio_highlight_text_color);
                    ?>
;"></div>
														<div class="portfolio-view-content">
															<div class="portfolio-view-animate">
																<header class="entry-header">
																	<a class="wpb_button_a" href="<?php 
                    if (!empty($portfolio_custom_url)) {
                        echo esc_url($portfolio_custom_url);
                    } else {
                        the_permalink();
                    }
                    ?>
" <?php 
                    if (!empty($portfolio_custom_url)) {
                        echo 'target="_blank"';
                    }
                    ?>
><?php 
                    _e("View", "mega");
                    ?>
</a>
																	<a class="wpb_button_a fb-lightbox" href="<?php 
                    echo esc_url($portfolio_image_lightbox);
                    ?>
" rel="fb-gallery" data-caption="<?php 
                    the_title();
                    ?>
"><?php 
                    _e("Zoom", "mega");
                    ?>
</a>
																</header><!-- .entry-header -->
															</div>
														</div>
												</div>
										</div>
									<?php 
                }
                ?>
												<header class="entry-header">
													<a class="content-wrapper" href="<?php 
                if (!empty($portfolio_custom_url)) {
                    echo esc_url($portfolio_custom_url);
                } else {
                    the_permalink();
                }
                ?>
" <?php 
                if (!empty($portfolio_custom_url)) {
                    ?>
target="_blank" <?php 
                }
                ?>
>
														<h2><?php 
                the_title();
                ?>
</h2>
													</a>
												</header><!-- .entry-header -->
											<?php 
                if ($meta_data == 'Categories') {
                    ?>
												<div class="entry-category"><?php 
                    echo mega_custom_taxonomies_terms_links();
                    ?>
</div><!-- .entry-category -->
											<?php 
                } else {
                    if ($meta_data == 'Excerpt') {
                        ?>
												<div class="entry-excerpt"><?php 
                        the_excerpt();
                        ?>
</div>
											<?php 
                    } else {
                        if ($meta_data == 'Both') {
                            ?>
												<div class="entry-excerpt"><?php 
                            the_excerpt();
                            ?>
</div>
												<div class="entry-category"><?php 
                            echo mega_custom_taxonomies_terms_links();
                            ?>
</div><!-- .entry-category -->
											<?php 
                        }
                    }
                }
                ?>
								</div><!-- .content-wrapper -->
							</article><!-- #post-<?php 
                the_ID();
                ?>
 -->
							
						<?php 
            } else {
                if ($style == '3') {
                    ?>
						
								
							<article id="post-<?php 
                    the_ID();
                    ?>
" <?php 
                    post_class('clearfix');
                    ?>
>
								<div class="browser-bar"><div class="browser-button"></div><div class="browser-button"></div><div class="browser-button"></div></div>
								<a class="content-wrapper" href="<?php 
                    if (!empty($portfolio_custom_url)) {
                        echo esc_url($portfolio_custom_url);
                    } else {
                        the_permalink();
                    }
                    ?>
" <?php 
                    if (!empty($portfolio_custom_url)) {
                        ?>
target="_blank" <?php 
                    }
                    ?>
>
									<?php 
                    if ($thumbnail) {
                        ?>
										<div class="post-thumbnail clearfix">
										<?php 
                        $portfolio_highlight_text_color = get_post_meta(get_the_ID(), 'portfolio_highlight_text_color', true);
                        ?>
										<?php 
                        $portfolio_highlight_background_color = get_post_meta(get_the_ID(), 'portfolio_highlight_background_color', true);
                        ?>
										<?php 
                        $rgb = mega_hex2rgb($portfolio_highlight_background_color);
                        ?>
										<?php 
                        $opacity = 0.8;
                        ?>
										<?php 
                        $rgba = "rgba(" . $rgb[0] . ", " . $rgb[1] . ", " . $rgb[2] . ", " . $opacity . ")";
                        ?>
												<?php 
                        echo $thumbnail;
                        ?>
										</div>
									<?php 
                    }
                    ?>
												<header class="entry-header portfolio-data">
													<h2><?php 
                    the_title();
                    ?>
</h2>
												</header><!-- .entry-header -->
											<?php 
                    if ($meta_data == 'Categories') {
                        ?>
												<div class="entry-category"><?php 
                        echo mega_custom_taxonomies_terms_links();
                        ?>
</div><!-- .entry-category -->
											<?php 
                    } else {
                        if ($meta_data == 'Excerpt') {
                            ?>
												<div class="entry-excerpt"><?php 
                            the_excerpt();
                            ?>
</div>
											<?php 
                        } else {
                            if ($meta_data == 'Both') {
                                ?>
												<div class="entry-excerpt"><?php 
                                the_excerpt();
                                ?>
</div>
												<div class="entry-category"><?php 
                                echo mega_custom_taxonomies_terms_links();
                                ?>
</div><!-- .entry-category -->
											<?php 
                            }
                        }
                    }
                    ?>
								</a><!-- .content-wrapper -->
							</article><!-- #post-<?php 
                    the_ID();
                    ?>
 -->
							
						
						<?php 
                } else {
                    if ($style == '4') {
                        ?>
						
								
							<article id="post-<?php 
                        the_ID();
                        ?>
" <?php 
                        post_class('clearfix');
                        ?>
>
								<a class="content-wrapper" href="<?php 
                        if (!empty($portfolio_custom_url)) {
                            echo esc_url($portfolio_custom_url);
                        } else {
                            the_permalink();
                        }
                        ?>
" <?php 
                        if (!empty($portfolio_custom_url)) {
                            ?>
target="_blank" <?php 
                        }
                        ?>
>
									<?php 
                        if ($thumbnail) {
                            ?>
										<div class="post-thumbnail clearfix">
										<?php 
                            $portfolio_highlight_text_color = get_post_meta(get_the_ID(), 'portfolio_highlight_text_color', true);
                            ?>
										<?php 
                            $portfolio_highlight_background_color = get_post_meta(get_the_ID(), 'portfolio_highlight_background_color', true);
                            ?>
										<?php 
                            $rgb = mega_hex2rgb($portfolio_highlight_background_color);
                            ?>
										<?php 
                            $opacity = 0.8;
                            ?>
										<?php 
                            $rgba = "rgba(" . $rgb[0] . ", " . $rgb[1] . ", " . $rgb[2] . ", " . $opacity . ")";
                            ?>
												<?php 
                            echo $thumbnail;
                            ?>
										</div>
									<?php 
                        }
                        ?>
												<header class="entry-header portfolio-data">
													<h2><?php 
                        the_title();
                        ?>
</h2>
												</header><!-- .entry-header -->
											<?php 
                        if ($meta_data == 'Categories') {
                            ?>
												<div class="entry-category"><?php 
                            echo mega_custom_taxonomies_terms_links();
                            ?>
</div><!-- .entry-category -->
											<?php 
                        } else {
                            if ($meta_data == 'Excerpt') {
                                ?>
												<div class="entry-excerpt"><?php 
                                the_excerpt();
                                ?>
</div>
											<?php 
                            } else {
                                if ($meta_data == 'Both') {
                                    ?>
												<div class="entry-excerpt"><?php 
                                    the_excerpt();
                                    ?>
</div>
												<div class="entry-category"><?php 
                                    echo mega_custom_taxonomies_terms_links();
                                    ?>
</div><!-- .entry-category -->
											<?php 
                                }
                            }
                        }
                        ?>
								</a><!-- .content-wrapper -->
							</article><!-- #post-<?php 
                        the_ID();
                        ?>
 -->
							
								
						<?php 
                    } else {
                        if ($style == '5') {
                            ?>
						
							<article id="post-<?php 
                            the_ID();
                            ?>
" <?php 
                            post_class('clearfix portfolio-style-5');
                            ?>
>
								<div class="content-wrapper">
									<?php 
                            if ($thumbnail) {
                                ?>
										<div class="post-thumbnail clearfix">
										<?php 
                                $portfolio_highlight_text_color = get_post_meta(get_the_ID(), 'portfolio_highlight_text_color', true);
                                ?>
										<?php 
                                $portfolio_highlight_background_color = get_post_meta(get_the_ID(), 'portfolio_highlight_background_color', true);
                                ?>
										<?php 
                                $rgb = mega_hex2rgb($portfolio_highlight_background_color);
                                ?>
										<?php 
                                $opacity = 0.8;
                                ?>
										<?php 
                                $rgba = "rgba(" . $rgb[0] . ", " . $rgb[1] . ", " . $rgb[2] . ", " . $opacity . ")";
                                ?>
										<a class="content-wrapper" href="<?php 
                                if (!empty($portfolio_custom_url)) {
                                    echo esc_url($portfolio_custom_url);
                                } else {
                                    the_permalink();
                                }
                                ?>
" <?php 
                                if (!empty($portfolio_custom_url)) {
                                    ?>
target="_blank" <?php 
                                }
                                ?>
>
												<?php 
                                echo $thumbnail;
                                ?>
												<div class="portfolio-view-wrapper">
													<div class="portfolio-bg" style="background-color: <?php 
                                echo esc_attr($portfolio_highlight_background_color);
                                ?>
; background-color: <?php 
                                echo esc_attr($rgba);
                                ?>
; color: <?php 
                                echo esc_attr($portfolio_highlight_text_color);
                                ?>
;"></div>
														<div class="portfolio-view-content">
															<div class="portfolio-view-animate">
																<header class="entry-header">
																	<h2><?php 
                                the_title();
                                ?>
</h2>
																</header><!-- .entry-header -->
																<?php 
                                if ($meta_data == 'Categories') {
                                    ?>
																	<div class="entry-category" style="color: <?php 
                                    echo esc_attr($portfolio_highlight_text_color);
                                    ?>
;"><?php 
                                    echo mega_custom_taxonomies_terms_links();
                                    ?>
</div><!-- .entry-category -->
																<?php 
                                } else {
                                    if ($meta_data == 'Excerpt') {
                                        ?>
																	<div class="entry-excerpt" style="color: <?php 
                                        echo esc_attr($portfolio_highlight_text_color);
                                        ?>
;"><?php 
                                        the_excerpt();
                                        ?>
</div>
																<?php 
                                    } else {
                                        if ($meta_data == 'Both') {
                                            ?>
																	<div class="entry-excerpt" style="color: <?php 
                                            echo esc_attr($portfolio_highlight_text_color);
                                            ?>
;"><?php 
                                            the_excerpt();
                                            ?>
</div>
																	<div class="entry-category" style="color: <?php 
                                            echo esc_attr($portfolio_highlight_text_color);
                                            ?>
;"><?php 
                                            echo mega_custom_taxonomies_terms_links();
                                            ?>
</div><!-- .entry-category -->
																<?php 
                                        }
                                    }
                                }
                                ?>
															</div>
														</div>
												</div>
											</a>
										</div>
									<?php 
                            }
                            ?>
								</div><!-- .content-wrapper -->
							</article><!-- #post-<?php 
                            the_ID();
                            ?>
 -->
						
						
						<?php 
                        } else {
                            ?>
						
							
							<?php 
                            //$portfolio_50_width = get_post_meta( get_the_ID(), 'portfolio_50_width', true );
                            ?>
							<?php 
                            //if ($portfolio_50_width_enable!='' && $portfolio_50_width_enable!='0') {
                            ?>
								<?php 
                            //if ( ! empty( $portfolio_50_width ) ) {
                            ?>
									<?php 
                            //$portfolio_50_width = 'portfolio-50-width';
                            ?>
								<?php 
                            //}
                            ?>
							<?php 
                            //}
                            ?>
							<?php 
                            $classes = array('clearfix');
                            ?>
							<article id="post-<?php 
                            the_ID();
                            ?>
" <?php 
                            post_class($classes);
                            ?>
>
								<div class="content-wrapper">
									<?php 
                            if ($thumbnail) {
                                ?>
										<div class="post-thumbnail clearfix">
										<?php 
                                $portfolio_highlight_text_color = get_post_meta(get_the_ID(), 'portfolio_highlight_text_color', true);
                                ?>
										<?php 
                                $portfolio_highlight_background_color = get_post_meta(get_the_ID(), 'portfolio_highlight_background_color', true);
                                ?>
										<?php 
                                $rgb = mega_hex2rgb($portfolio_highlight_background_color);
                                ?>
										<?php 
                                $opacity = 0.8;
                                ?>
										<?php 
                                $rgba = "rgba(" . $rgb[0] . ", " . $rgb[1] . ", " . $rgb[2] . ", " . $opacity . ")";
                                ?>
										<a class="content-wrapper" href="<?php 
                                if (!empty($portfolio_custom_url)) {
                                    echo esc_url($portfolio_custom_url);
                                } else {
                                    the_permalink();
                                }
                                ?>
" <?php 
                                if (!empty($portfolio_custom_url)) {
                                    ?>
target="_blank" <?php 
                                }
                                ?>
>
												<?php 
                                echo $thumbnail;
                                ?>
												<div class="portfolio-view-wrapper">
													<div class="portfolio-bg" style="background-color: <?php 
                                echo esc_attr($portfolio_highlight_background_color);
                                ?>
; background-color: <?php 
                                echo esc_attr($rgba);
                                ?>
; color: <?php 
                                echo esc_attr($portfolio_highlight_text_color);
                                ?>
;"></div>
														<div class="portfolio-view-content">
															<div class="portfolio-view-animate">
																<header class="entry-header">
																	<h2><?php 
                                the_title();
                                ?>
</h2>
																</header><!-- .entry-header -->
																<?php 
                                if ($meta_data == 'Categories') {
                                    ?>
																	<div class="entry-category" style="color: <?php 
                                    echo esc_attr($portfolio_highlight_text_color);
                                    ?>
;"><?php 
                                    echo mega_custom_taxonomies_terms_links();
                                    ?>
</div><!-- .entry-category -->
																<?php 
                                } else {
                                    if ($meta_data == 'Excerpt') {
                                        ?>
																	<div class="entry-excerpt" style="color: <?php 
                                        echo esc_attr($portfolio_highlight_text_color);
                                        ?>
;"><?php 
                                        the_excerpt();
                                        ?>
</div>
																<?php 
                                    } else {
                                        if ($meta_data == 'Both') {
                                            ?>
																	<div class="entry-excerpt" style="color: <?php 
                                            echo esc_attr($portfolio_highlight_text_color);
                                            ?>
;"><?php 
                                            the_excerpt();
                                            ?>
</div>
																	<div class="entry-category" style="color: <?php 
                                            echo esc_attr($portfolio_highlight_text_color);
                                            ?>
;"><?php 
                                            echo mega_custom_taxonomies_terms_links();
                                            ?>
</div><!-- .entry-category -->
																<?php 
                                        }
                                    }
                                }
                                ?>
															</div>
														</div>
												</div>
											</a>
										</div>
									<?php 
                            }
                            ?>
								</div><!-- .content-wrapper -->
							</article><!-- #post-<?php 
                            the_ID();
                            ?>
 -->
							
							
						<?php 
                            //}
                            ?>
					<?php 
                        }
                    }
                }
            }
            ?>
				<?php 
        }
        ?>
				
			<?php 
    }
    ?>
		
		</div><!-- #portfolio -->
		
		<?php 
    if ($pagination != '' && $pagination != '0') {
        ?>
			<?php 
        mega_pagination_content_nav('nav-pagination');
        ?>
		<?php 
    }
    ?>
		
		<?php 
    wp_reset_postdata();
    ?>
	
	</div><!-- #block-portfolio -->
	
    <?php 
    $wp_query = null;
    $wp_query = $temp;
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}