function thb_breadcrumb()
{
    global $post, $wp_query;
    $id = $wp_query->get_queried_object_id();
    echo '<aside class="breadcrumb">';
    if (!is_front_page()) {
        echo '<a href="';
        echo home_url();
        echo '">' . __('Home', THB_THEME_NAME);
        echo "</a>";
    }
    if (is_singular('portfolio')) {
        $portfolio_main = get_post_meta($post->ID, 'portfolio_main', TRUE);
        if ($portfolio_main) {
            $portfolio_link = get_permalink($portfolio_main);
        } else {
            $portfolio_link = get_portfolio_page_link(get_the_ID());
        }
        echo '<span>/</span> <a href="' . $portfolio_link . '">' . __('Portfolio', THB_THEME_NAME) . '</a>';
        echo '<span>/</span>' . get_the_title();
    }
    if (is_home()) {
        echo '<span>/</span>' . __('Blog', THB_THEME_NAME);
    }
    if (is_page() && !is_front_page()) {
        $parents = array();
        $parent_id = $post->post_parent;
        while ($parent_id) {
            $page = get_page($parent_id);
            $parents[] = '<span>/</span><a href="' . get_permalink($page->ID) . '" title="' . get_the_title($page->ID) . '">' . get_the_title($page->ID) . '</a>';
            $parent_id = $page->post_parent;
        }
        $parents = array_reverse($parents);
        echo join(' ', $parents);
        echo '<span>/</span>' . get_the_title();
    }
    if (is_single() && !is_singular('portfolio')) {
        $categories = get_the_category();
        if ($categories) {
            foreach ($categories as $cat) {
                $cats[] = '<a href="' . get_category_link($cat->term_id) . '" title="' . $cat->name . '">' . $cat->name . '</a>';
            }
            echo '<span>/</span>' . join(', ', $cats);
        }
        echo '<span>/</span>' . ShortenText(get_the_title(), 40);
    }
    if (is_archive()) {
        if (class_exists('woocommerce') && is_woocommerce() && is_shop()) {
            echo '<span>/</span>' . get_the_title(wc_get_page_id('shop'));
        } else {
            echo '<span>/</span>' . thb_which_archive();
        }
    }
    if (is_search()) {
        echo '<span>/</span>' . thb_which_archive();
    }
    echo '</aside>';
}
    while (have_posts()) {
        the_post();
        ?>
  	<?php 
        $layout = get_post_meta($post->ID, 'portfolio_layout', true);
        $format = get_post_meta($post->ID, 'portfolio_type', true);
        $portfolio_main = get_post_meta($post->ID, 'portfolio_main', TRUE);
        $meta = get_the_term_list($post->ID, 'project-category', '<span>', '</span>, <span>', '</span>');
        $meta = preg_replace('/<a href=\\"(.*?)\\">(.*?)<\\/a>/', "\\2", $meta);
        $attributes = get_post_meta($post->ID, 'portfolio_attributes', TRUE);
        ?>
  	<?php 
        if ($portfolio_main) {
            $portfolio_link = get_permalink($portfolio_main);
        } else {
            $portfolio_link = get_portfolio_page_link(get_the_ID());
        }
        ?>
  	<?php 
        if ($layout == 'layout2') {
            ?>
  		<article <?php 
            post_class('post blog-post portfolio-post');
            ?>
 id="post-<?php 
            the_ID();
            ?>
">
  			<div class="row">
  				<div class="small-12 medium-7 columns">
  					<?php 
Esempio n. 3
0
    function nectar_page_header($postid)
    {
        global $options;
        global $post;
        global $nectar_theme_skin;
        $bg = get_post_meta($postid, '_nectar_header_bg', true);
        $bg_color = get_post_meta($postid, '_nectar_header_bg_color', true);
        $font_color = get_post_meta($postid, '_nectar_header_font_color', true);
        $parallax_bg = get_post_meta($postid, '_nectar_header_parallax', true);
        $title = get_post_meta($postid, '_nectar_header_title', true);
        $subtitle = get_post_meta($postid, '_nectar_header_subtitle', true);
        $height = get_post_meta($postid, '_nectar_header_bg_height', true);
        $page_template = get_post_meta($postid, '_wp_page_template', true);
        $display_sortable = get_post_meta($postid, 'nectar-metabox-portfolio-display-sortable', true);
        $inline_filters = !empty($options['portfolio_inline_filters']) && $options['portfolio_inline_filters'] == '1' ? '1' : '0';
        $filters_id = !empty($options['portfolio_inline_filters']) && $options['portfolio_inline_filters'] == '1' ? 'portfolio-filters-inline' : 'portfolio-filters';
        $text_align = get_post_meta($postid, '_nectar_page_header_alignment', true);
        $text_align_v = get_post_meta($postid, '_nectar_page_header_alignment_v', true);
        $fullscreen_header = !empty($options['blog_header_type']) && $options['blog_header_type'] == 'fullscreen' && is_singular('post') ? true : false;
        $bottom_shadow = get_post_meta($postid, '_nectar_header_bottom_shadow', true);
        $bg_overlay = get_post_meta($postid, '_nectar_header_overlay', true);
        $text_effect = get_post_meta($postid, '_nectar_page_header_text-effect', true);
        !empty($display_sortable) && $display_sortable == 'on' ? $display_sortable = '1' : ($display_sortable = '0');
        //incase no title is entered for portfolio, still show the filters
        if ($page_template == 'template-portfolio.php' && empty($title)) {
            $title = get_the_title($post->ID);
        }
        $bg_type = get_post_meta($postid, '_nectar_slider_bg_type', true);
        if (empty($bg_type)) {
            $bg_type = 'image_bg';
        }
        if (!empty($bg) || !empty($bg_color) || $bg_type == 'video_bg' || $bg_type == 'particle_bg') {
            empty($bg) ? $social_img_src = 'none' : ($social_img_src = $bg);
            empty($bg) ? $bg = 'none' : ($bg = 'url(' . $bg . ')');
            if ($bg_type == 'image_bg' || $bg_type == 'particle_bg') {
                empty($bg_color) ? $bg_color = '#000' : ($bg_color = $bg_color);
            } else {
                $bg = 'none';
                //remove stnd bg image for video BG type
            }
            $bg_color_string = !empty($bg_color) ? 'background-color: ' . $bg_color . '; ' : null;
            if ($bg_type == 'particle_bg') {
                $rotate_timing = get_post_meta($postid, '_nectar_particle_rotation_timing', true);
                $disable_explosion = get_post_meta($postid, '_nectar_particle_disable_explosion', true);
                $shapes = get_post_meta($postid, '_nectar_canvas_shapes', true);
                if (empty($shapes)) {
                    $bg_type = 'image_bg';
                }
            }
            if ($bg_type == 'video_bg') {
                $video_webm = get_post_meta($postid, '_nectar_media_upload_webm', true);
                $video_mp4 = get_post_meta($postid, '_nectar_media_upload_mp4', true);
                $video_ogv = get_post_meta($postid, '_nectar_media_upload_ogv', true);
                $video_image = get_post_meta($postid, '_nectar_slider_preview_image', true);
            }
            $box_roll = get_post_meta($postid, '_nectar_header_box_roll', true);
            if (!empty($options['boxed_layout']) && $options['boxed_layout'] == '1') {
                $box_roll = 'off';
            }
            $bg_position = get_post_meta($postid, '_nectar_page_header_bg_alignment', true);
            if (empty($bg_position)) {
                $bg_position = 'top';
            }
            $height = !empty($height) ? preg_replace('/\\s+/', '', $height) : $height;
            $not_loaded_class = $nectar_theme_skin != 'ascend' ? "not-loaded" : null;
            $page_fullscreen_header = get_post_meta($postid, '_nectar_header_fullscreen', true);
            $fullscreen_class = $fullscreen_header == true || $page_fullscreen_header == 'on' ? "fullscreen-header" : null;
            $bottom_shadow_class = $bottom_shadow == 'on' ? " bottom-shadow" : null;
            $bg_overlay_class = $bg_overlay == 'on' ? " bg-overlay" : null;
            $ajax_page_loading = !empty($options['ajax-page-loading']) && $options['ajax-page-loading'] == '1' ? true : false;
            $wrapper_height_style = $fullscreen_header == true && ($post->post_type == 'post' && is_single()) || $ajax_page_loading == false || $page_fullscreen_header == 'on' ? null : 'style="height: ' . $height . 'px;"';
            $midnight_non_parallax = !empty($parallax_bg) && $parallax_bg == 'on' ? null : 'data-midnight="light"';
            if (!empty($parallax_bg) && $parallax_bg == 'on') {
                echo '<div id="page-header-wrap" data-midnight="light" class="' . $fullscreen_class . '" ' . $wrapper_height_style . '>';
            }
            if (!empty($box_roll) && $box_roll == 'on') {
                wp_enqueue_style('box-roll');
                echo '<div class="nectar-box-roll">';
            }
            ?>
	    <div class="<?php 
            echo $not_loaded_class . ' ' . $fullscreen_class . $bottom_shadow_class . $bg_overlay_class;
            ?>
"  id="page-header-bg" <?php 
            echo $midnight_non_parallax;
            ?>
 data-text-effect="<?php 
            echo $text_effect;
            ?>
" data-bg-pos="<?php 
            echo $bg_position;
            ?>
" data-alignment="<?php 
            echo !empty($text_align) ? $text_align : 'left';
            ?>
" data-alignment-v="<?php 
            echo !empty($text_align_v) ? $text_align_v : 'middle';
            ?>
" data-parallax="<?php 
            echo !empty($parallax_bg) && $parallax_bg == 'on' ? '1' : '0';
            ?>
" data-height="<?php 
            echo !empty($height) ? $height : '350';
            ?>
" style="<?php 
            echo $bg_color_string;
            ?>
 background-image: <?php 
            echo nectar_options_img($bg);
            ?>
; height: <?php 
            echo $height;
            ?>
px;">
			

			<?php 
            if ($bg_type != 'particle_bg') {
                echo '<div class="container">';
            }
            if ($post->ID != 0 && $post->post_type && $post->post_type == 'portfolio') {
                ?>
					
					<div class="row project-title">
					<div class="container">
					<div class="col span_6 section-title <?php 
                if (empty($options['portfolio_social']) || $options['portfolio_social'] == 0 || empty($options['portfolio_date']) || $options['portfolio_date'] == 0) {
                    echo 'no-date';
                }
                ?>
">
						
						<h1><?php 
                the_title();
                ?>
</h1>
						
						<?php 
                $options = get_option('salient');
                $back_to_all_override = get_post_meta($post->ID, 'nectar-metabox-portfolio-parent-override', true);
                if (empty($back_to_all_override)) {
                    $back_to_all_override = 'default';
                }
                //attempt to find parent portfolio page - if unsuccessful default to main portfolio page
                global $post;
                $terms = get_the_terms($post->id, "project-type");
                $project_cat = null;
                $portfolio_link = null;
                if (empty($terms)) {
                    $terms = array('1' => (object) array('name' => 'nothing', 'slug' => 'none'));
                }
                foreach ($terms as $term) {
                    $project_cat = strtolower($term->name);
                }
                $page = get_page_by_title_search($project_cat);
                if (empty($page)) {
                    $page = array('0' => (object) array('ID' => 'nothing'));
                }
                $page_link = verify_portfolio_page($page[0]->ID);
                //if a page has been found for the category
                if (!empty($page_link) && $back_to_all_override == 'default') {
                    $portfolio_link = $page_link;
                    ?>
							 
							 <div id="portfolio-nav">
							 	<ul>
							 		<li id="all-items"><a href="<?php 
                    echo $portfolio_link;
                    ?>
"><i class="icon-salient-back-to-all"></i></a></li>               
							 	</ul>
								<ul class="controls">                                 
									<li id="prev-link"><?php 
                    be_next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>', TRUE, null, 'project-type');
                    ?>
</li>
									<li id="next-link"><?php 
                    be_previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>', TRUE, null, 'project-type');
                    ?>
</li> 
								</ul>
							</div>
							 
					<?php 
                } else {
                    $portfolio_link = get_portfolio_page_link(get_the_ID());
                    if (!empty($options['main-portfolio-link'])) {
                        $portfolio_link = $options['main-portfolio-link'];
                    }
                    if ($back_to_all_override != 'default') {
                        $portfolio_link = get_page_link($back_to_all_override);
                    }
                    ?>
							
							<div id="portfolio-nav">
								<ul>
									<li id="all-items"><a href="<?php 
                    echo $portfolio_link;
                    ?>
"><i class="icon-salient-back-to-all"></i></a></li>  
								</ul>
								<ul class="controls">                                       
									<?php 
                    if (!empty($options['portfolio_same_category_single_nav']) && $options['portfolio_same_category_single_nav'] == '1') {
                        // get_posts in same custom taxonomy
                        $terms = get_the_terms($post->id, "project-type");
                        $project_cat = null;
                        if (empty($terms)) {
                            $terms = array('1' => (object) array('name' => 'nothing', 'slug' => 'none'));
                        }
                        foreach ($terms as $term) {
                            $project_cat = strtolower($term->slug);
                        }
                        $postlist_args = array('posts_per_page' => -1, 'orderby' => 'menu_order title', 'order' => 'ASC', 'post_type' => 'portfolio', 'project-type' => $project_cat);
                        $postlist = get_posts($postlist_args);
                        // get ids of posts retrieved from get_posts
                        $ids = array();
                        foreach ($postlist as $thepost) {
                            $ids[] = $thepost->ID;
                        }
                        // get and echo previous and next post in the same taxonomy
                        $thisindex = array_search($post->ID, $ids);
                        $previd = isset($ids[$thisindex - 1]) ? $ids[$thisindex - 1] : null;
                        $nextid = isset($ids[$thisindex + 1]) ? $ids[$thisindex + 1] : null;
                        if (!empty($previd)) {
                            echo '<li id="prev-link"><a rel="prev" href="' . get_permalink($previd) . '"><i class="icon-salient-left-arrow-thin"></i></a></li>';
                        }
                        if (!empty($nextid)) {
                            echo '<li id="next-link"><a rel="next" href="' . get_permalink($nextid) . '"><i class="icon-salient-right-arrow-thin"></i></a></li>';
                        }
                        ?>


										<?php 
                    } else {
                        ?>
											<li id="prev-link"><?php 
                        next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>');
                        ?>
</li>
											<li id="next-link"><?php 
                        previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>');
                        ?>
</li> 
										<?php 
                    }
                    ?>
								</ul>
							</div>
					 <?php 
                }
                ?>
						
					</div>
				</div> 
			
			</div><!--/row-->
						
						
						
						
						
						
						
					<?php 
            } elseif ($post->ID != 0 && $post->post_type == 'post' && is_single()) {
                // also set as an img for social sharing/
                if ($social_img_src != 'none') {
                    echo '<img class="hidden-social-img" src="' . $social_img_src . '" alt="' . get_the_title() . '" />';
                }
                ?>
						
						<div class="row">
							<div class="col span_6 section-title blog-title">
								<div class="inner-wrap">
									<h1 class="entry-title"><?php 
                the_title();
                ?>
</h1>

									 <?php 
                if ($post->post_type == 'post' && is_single() && $fullscreen_header == true) {
                    ?>
									 	<div class="author-section">
										 	<span class="meta-author vcard author">  
										 		<?php 
                    if (function_exists('get_avatar')) {
                        echo get_avatar(get_the_author_meta('email'), 100);
                    }
                    ?>
										 	</span> 
										 	<div class="avatar-post-info">
											 	<span class="fn"><?php 
                    the_author_posts_link();
                    ?>
</span>
											 	<span class="meta-date date updated"><i><?php 
                    echo get_the_date();
                    ?>
</i></span>
											 </div>
										</div>
								<?php 
                }
                ?>
							
							<?php 
                if ($fullscreen_header != true) {
                    ?>

								<div id="single-below-header">
									<span class="meta-author vcard author"><span class="fn"><?php 
                    echo __('By', NECTAR_THEME_NAME);
                    ?>
 <?php 
                    the_author_posts_link();
                    ?>
</span></span> 
									<?php 
                    if (!empty($options['blog_social']) && $options['blog_social'] == 1) {
                        ?>
										<span class="meta-date date updated"><?php 
                        echo get_the_date();
                        ?>
</span>
									<?php 
                    }
                    ?>
									<span class="meta-category"><?php 
                    the_category(', ');
                    ?>
</span>
									<span class="meta-comment-count"><a href="<?php 
                    comments_link();
                    ?>
"><?php 
                    comments_number(__('No Comments', NECTAR_THEME_NAME), __('One Comment ', NECTAR_THEME_NAME), __('% Comments', NECTAR_THEME_NAME));
                    ?>
</a></span>
								
								</div><!--/single-below-header-->
								
								<div id="single-meta" data-sharing="<?php 
                    echo !empty($options['blog_social']) && $options['blog_social'] == 1 ? '1' : '0';
                    ?>
">
									<ul>
		
										<?php 
                    if (empty($options['blog_social']) || $options['blog_social'] == 0) {
                        ?>
											   	
											   	<li>
											   		<?php 
                        echo '<span class="n-shortcode">' . nectar_love('return') . '</span>';
                        ?>
											   	</li>
												<li>
													<?php 
                        echo get_the_date();
                        ?>
												</li>
										
										<?php 
                    }
                    ?>
			
									</ul>
									
									<?php 
                    if (!empty($options['blog_social']) && $options['blog_social'] == 1) {
                        echo '<div class="nectar-social">';
                        echo '<span class="n-shortcode">' . nectar_love('return') . '</span>';
                        //facebook
                        if (!empty($options['blog-facebook-sharing']) && $options['blog-facebook-sharing'] == 1) {
                            echo "<a class='facebook-share nectar-sharing' href='#' title='" . __('Share this', NECTAR_THEME_NAME) . "'> <i class='icon-facebook'></i> <span class='count'></span></a>";
                        }
                        //twitter
                        if (!empty($options['blog-twitter-sharing']) && $options['blog-twitter-sharing'] == 1) {
                            echo "<a class='twitter-share nectar-sharing' href='#' title='" . __('Tweet this', NECTAR_THEME_NAME) . "'> <i class='icon-twitter'></i> <span class='count'></span></a>";
                        }
                        //google plus
                        if (!empty($options['blog-google-plus-sharing']) && $options['blog-google-plus-sharing'] == 1) {
                            echo "<a class='google-plus-share nectar-sharing-alt' href='#' title='" . __('Share this', NECTAR_THEME_NAME) . "'> <i class='icon-google-plus'></i> <span class='count'> " . GetGooglePlusShares(get_permalink($post->ID)) . " </span></a>";
                        }
                        //linkedIn
                        if (!empty($options['blog-linkedin-sharing']) && $options['blog-linkedin-sharing'] == 1) {
                            echo "<a class='linkedin-share nectar-sharing' href='#' title='" . __('Share this', NECTAR_THEME_NAME) . "'> <i class='icon-linkedin'></i> <span class='count'> </span></a>";
                        }
                        //pinterest
                        if (!empty($options['blog-pinterest-sharing']) && $options['blog-pinterest-sharing'] == 1) {
                            echo "<a class='pinterest-share nectar-sharing' href='#' title='" . __('Pin this', NECTAR_THEME_NAME) . "'> <i class='icon-pinterest'></i> <span class='count'></span></a>";
                        }
                        echo '</div>';
                    }
                    ?>
									
								</div><!--/single-meta-->

							<?php 
                }
                //end if theme skin default
                ?>
						    </div>
						</div><!--/section-title-->
					</div><!--/row-->
						
							
						
						
					
					<?php 
                //default
            } else {
                if ($bg_type != 'particle_bg') {
                    if (!empty($box_roll) && $box_roll == 'on') {
                        $alignment = !empty($text_align) ? $text_align : 'left';
                        $v_alignment = !empty($text_align_v) ? $text_align_v : 'middle';
                        echo '<div class="overlaid-content" data-text-effect="' . $text_effect . '" data-alignment="' . $alignment . '" data-alignment-v="' . $v_alignment . '"><div class="container">';
                    }
                    ?>

						 <div class="row">
							<div class="col span_6">
								<div class="inner-wrap">
									<h1><?php 
                    echo $title;
                    ?>
</h1>
									<span class="subheader"><?php 
                    echo $subtitle;
                    ?>
</span>
								</div>
								 
								<?php 
                    // portfolio filters
                    if ($page_template == 'template-portfolio.php' && $display_sortable == '1' && $inline_filters == '0') {
                        ?>
									<div class="<?php 
                        echo $filters_id;
                        ?>
" instance="0">
											<a href="#" data-sortable-label="<?php 
                        echo !empty($options['portfolio-sortable-text']) ? $options['portfolio-sortable-text'] : 'Sort Portfolio';
                        ?>
" id="sort-portfolio"><span><?php 
                        echo !empty($options['portfolio-sortable-text']) ? $options['portfolio-sortable-text'] : __('Sort Portfolio', NECTAR_THEME_NAME);
                        ?>
</span> <i class="icon-angle-down"></i></a> 
										<ul>
										   <li><a href="#" data-filter="*"><?php 
                        echo __('All', NECTAR_THEME_NAME);
                        ?>
</a></li>
						               	   <?php 
                        wp_list_categories(array('title_li' => '', 'taxonomy' => 'project-type', 'show_option_none' => '', 'walker' => new Walker_Portfolio_Filter()));
                        ?>
										</ul>
									</div>
								<?php 
                    }
                    ?>
								</div>
						  </div>
					  
					  <?php 
                    if (!empty($box_roll) && $box_roll == 'on') {
                        echo '</div></div><!--/overlaid-content-->';
                    }
                }
            }
            ?>
					
					
				
			<?php 
            if ($bg_type != 'particle_bg') {
                echo '</div>';
            }
            //closing container
            if ($post->ID != 0 && $post->post_type == 'post' && is_single() && $fullscreen_header == true || $page_fullscreen_header == 'on') {
                $rotate_in_class = $text_effect == 'rotate_in' ? 'hidden' : null;
                $button_styling = !empty($options['button-styling']) ? $options['button-styling'] : 'default';
                if ($button_styling == 'default') {
                    echo '<div class="scroll-down-wrap"><a href="#" class="section-down-arrow ' . $rotate_in_class . '"><i class="icon-salient-down-arrow icon-default-style"> </i></a></div>';
                } else {
                    echo '<div class="scroll-down-wrap ' . $rotate_in_class . '"><a href="#" class="section-down-arrow"><i class="fa fa-angle-down top"></i><i class="fa fa-angle-down"></i></a></div>';
                }
            }
            //video bg
            if ($bg_type == 'video_bg') {
                if (floatval(get_bloginfo('version')) >= "3.6") {
                    wp_enqueue_script('wp-mediaelement');
                    wp_enqueue_style('wp-mediaelement');
                } else {
                    //register media element for WordPress 3.5
                    wp_register_script('wp-mediaelement', get_template_directory_uri() . '/js/mediaelement-and-player.min.js', array('jquery'), '1.0', TRUE);
                    wp_register_style('wp-mediaelement', get_template_directory_uri() . '/css/mediaelementplayer.min.css');
                    wp_enqueue_script('wp-mediaelement');
                    wp_enqueue_style('wp-mediaelement');
                }
                //parse video image
                if (strpos($video_image, "http://") !== false) {
                    $video_image_src = $video_image;
                } else {
                    $video_image_src = wp_get_attachment_image_src($video_image, 'full');
                    $video_image_src = $video_image_src[0];
                }
                //$poster_markup = (!empty($video_image)) ? 'poster="'.$video_image_src.'"' : null ;
                $poster_markup = null;
                $video_markup = null;
                $video_markup .= '<div class="video-color-overlay" data-color="' . $bg_color . '"></div>';
                $video_markup .= '
			
			<div class="mobile-video-image" style="background-image: url(' . $video_image_src . ')"></div>
			<div class="nectar-video-wrap" data-bg-alignment="' . $bg_position . '">
				
				
				<video class="nectar-video-bg" width="1800" height="700" ' . $poster_markup . '  preload="auto" loop autoplay>';
                if (!empty($video_webm)) {
                    $video_markup .= '<source type="video/webm" src="' . $video_webm . '">';
                }
                if (!empty($video_mp4)) {
                    $video_markup .= '<source type="video/mp4" src="' . $video_mp4 . '">';
                }
                if (!empty($video_ogv)) {
                    $video_markup .= '<source type="video/ogg" src="' . $video_ogv . '">';
                }
                $video_markup .= '</video>
		
			</div>';
                echo $video_markup;
            }
            //particle bg
            if ($bg_type == 'particle_bg') {
                wp_enqueue_script('nectarParticles');
                echo '<div class=" nectar-particles" data-disable-explosion="' . $disable_explosion . '" data-rotation-timing="' . $rotate_timing . '"><div class="canvas-bg"><canvas id="canvas" data-active-index="0"></canvas></div>';
                $images = explode(',', $shapes);
                $i = 0;
                if (!empty($shapes)) {
                    if (!empty($box_roll) && $box_roll == 'on') {
                        $alignment = !empty($text_align) ? $text_align : 'left';
                        $v_alignment = !empty($text_align_v) ? $text_align_v : 'middle';
                        echo '<div class="overlaid-content" data-text-effect="' . $text_effect . '" data-alignment="' . $alignment . '" data-alignment-v="' . $v_alignment . '">';
                    }
                    echo '<div class="container"><div class="row"><div class="col span_6" >';
                    foreach ($images as $attach_id) {
                        $i++;
                        $img = wp_get_attachment_image_src($attach_id, 'full');
                        $attachment = get_post($attach_id);
                        $shape_meta = array('caption' => $attachment->post_excerpt, 'title' => $attachment->post_title, 'bg_color' => get_post_meta($attachment->ID, 'nectar_particle_shape_bg_color', true), 'color' => get_post_meta($attachment->ID, 'nectar_particle_shape_color', true), 'color_mapping' => get_post_meta($attachment->ID, 'nectar_particle_shape_color_mapping', true), 'alpha' => get_post_meta($attachment->ID, 'nectar_particle_shape_color_alpha', true), 'density' => get_post_meta($attachment->ID, 'nectar_particle_shape_density', true), 'max_particle_size' => get_post_meta($attachment->ID, 'nectar_particle_max_particle_size', true));
                        if (!empty($shape_meta['density'])) {
                            switch ($shape_meta['density']) {
                                case 'very_low':
                                    $shape_meta['density'] = '19';
                                    break;
                                case 'low':
                                    $shape_meta['density'] = '16';
                                    break;
                                case 'medium':
                                    $shape_meta['density'] = '13';
                                    break;
                                case 'high':
                                    $shape_meta['density'] = '10';
                                    break;
                                case 'very_high':
                                    $shape_meta['density'] = '8';
                                    break;
                            }
                        }
                        if (!empty($shape_meta['color']) && $shape_meta['color'] == '#fff' || !empty($shape_meta['color']) && $shape_meta['color'] == '#ffffff') {
                            $shape_meta['color'] = '#fefefe';
                        }
                        //data for particle shape
                        echo '<div class="shape" data-src="' . $img[0] . '" data-max-size="' . $shape_meta['max_particle_size'] . '" data-alpha="' . $shape_meta['alpha'] . '" data-density="' . $shape_meta['density'] . '" data-color-mapping="' . $shape_meta['color_mapping'] . '" data-color="' . $shape_meta['color'] . '" data-bg-color="' . $shape_meta['bg_color'] . '"></div>';
                        //overlaid content
                        echo '<div class="inner-wrap shape-' . $i . '">';
                        echo '<h1>' . $shape_meta["title"] . '</h1> <span class="subheader">' . $shape_meta["caption"] . '</span>';
                        echo '</div>';
                    }
                    ?>

	    		</div></div></div>

	    		<div class="pagination-navigation">
					<div class="pagination-current"></div>
					<div class="pagination-dots">
						<?php 
                    foreach ($images as $attach_id) {
                        echo '<button class="pagination-dot"></button>';
                    }
                    ?>
					</div>
				</div>
				<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="690">
				  <defs>
				    <filter id="goo">
				      <feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur"></feGaussianBlur>
				      <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 69 -16" result="goo"></feColorMatrix>
				      <feComposite in="SourceGraphic" in2="goo" operator="atop"></feComposite>
				    </filter>
				  </defs>
				</svg>

				<?php 
                    if (!empty($box_roll) && $box_roll == 'on') {
                        echo '</div><!--/overlaid-content-->';
                    }
                    ?>

			</div> <!--/nectar particles-->

			<?php 
                }
            }
            //particle bg
            ?>

		</div>

	   <?php 
            if (!empty($parallax_bg) && $parallax_bg == 'on' || !empty($box_roll) && $box_roll == 'on') {
                echo '</div>';
            }
            ?>

	    <?php 
        } else {
            if (!empty($title)) {
                ?>
	    	
		    <div class="row page-header-no-bg" data-alignment="<?php 
                echo !empty($text_align) ? $text_align : 'left';
                ?>
">
		    	<div class="container">	
					<div class="col span_12 section-title">
						<h1><?php 
                echo $title;
                if (!empty($subtitle)) {
                    echo '<span>' . $subtitle . '</span>';
                }
                ?>
</h1>
						
						<?php 
                // portfolio filters
                if ($page_template == 'template-portfolio.php' && $display_sortable == '1' && $inline_filters == '0') {
                    ?>
						<div class="<?php 
                    echo $filters_id;
                    ?>
" instance="0">
							
							<a href="#" data-sortable-label="<?php 
                    echo !empty($options['portfolio-sortable-text']) ? $options['portfolio-sortable-text'] : 'Sort Portfolio';
                    ?>
" id="sort-portfolio"><span><?php 
                    echo !empty($options['portfolio-sortable-text']) ? $options['portfolio-sortable-text'] : __('Sort Portfolio', NECTAR_THEME_NAME);
                    ?>
</span> <i class="icon-angle-down"></i></a> 
							
							<ul>
							   <li><a href="#" data-filter="*"><?php 
                    echo __('All', NECTAR_THEME_NAME);
                    ?>
</a></li>
			               	   <?php 
                    wp_list_categories(array('title_li' => '', 'taxonomy' => 'project-type', 'show_option_none' => '', 'walker' => new Walker_Portfolio_Filter()));
                    ?>
							</ul>
						</div>
					<?php 
                }
                ?>
						
					</div>
				</div>

			</div> 
	 	   	
	    <?php 
            }
        }
    }
Esempio n. 4
0
function project_single_controls()
{
    global $options;
    global $post;
    $back_to_all_override = get_post_meta($post->ID, 'nectar-metabox-portfolio-parent-override', true);
    if (empty($back_to_all_override)) {
        $back_to_all_override = 'default';
    }
    //attempt to find parent portfolio page - if unsuccessful default to main portfolio page
    $terms = get_the_terms($post->id, "project-type");
    $project_cat = null;
    $portfolio_link = null;
    $single_nav_pos = !empty($options['portfolio_single_nav']) ? $options['portfolio_single_nav'] : 'in_header';
    if (empty($terms)) {
        $terms = array('1' => (object) array('name' => 'nothing', 'slug' => 'none'));
    }
    foreach ($terms as $term) {
        $project_cat = strtolower($term->name);
    }
    $page = get_page_by_title_search($project_cat);
    if (empty($page)) {
        $page = array('0' => (object) array('ID' => 'nothing'));
    }
    $page_link = verify_portfolio_page($page[0]->ID);
    //if a page has been found for the category
    if (!empty($page_link) && $back_to_all_override == 'default') {
        $portfolio_link = $page_link;
        ?>
			 
			 <div id="portfolio-nav">
			 	<ul>
			 		<li id="all-items"><a href="<?php 
        echo $portfolio_link;
        ?>
"><i class="icon-salient-back-to-all"></i></a></li>               
			 	</ul>
				<ul class="controls">                                 
					<?php 
        if ($single_nav_pos == 'after_project') {
            ?>

						<li id="prev-link"><?php 
            be_next_post_link('%link', '<i class="icon-angle-left"></i> <span>' . __("Previous Project", NECTAR_THEMEN_NAME) . '</span>', TRUE, null, 'project-type');
            ?>
</li>
						<li id="next-link"><?php 
            be_previous_post_link('%link', '<span>' . __('Next Project', NECTAR_THEMEN_NAME) . '</span><i class="icon-angle-right"></i>', TRUE, null, 'project-type');
            ?>
</li> 
				
					<?php 
        } else {
            ?>

						<li id="prev-link"><?php 
            be_next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>', TRUE, null, 'project-type');
            ?>
</li>
						<li id="next-link"><?php 
            be_previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>', TRUE, null, 'project-type');
            ?>
</li> 

					<?php 
        }
        ?>
					
				</ul>
			</div>
			 
	<?php 
    } else {
        $portfolio_link = get_portfolio_page_link(get_the_ID());
        if (!empty($options['main-portfolio-link'])) {
            $portfolio_link = $options['main-portfolio-link'];
        }
        if ($back_to_all_override != 'default') {
            $portfolio_link = get_page_link($back_to_all_override);
        }
        ?>
			<div id="portfolio-nav">
				<ul>
					<li id="all-items"><a href="<?php 
        echo $portfolio_link;
        ?>
" title="<?php 
        echo __('Back to all projects', NECTAR_THEME_NAME);
        ?>
"><i class="icon-salient-back-to-all"></i></a></li>  
				</ul>

				<ul class="controls">    
					<?php 
        if (!empty($options['portfolio_same_category_single_nav']) && $options['portfolio_same_category_single_nav'] == '1') {
            // get_posts in same custom taxonomy
            $terms = get_the_terms($post->id, "project-type");
            $project_cat = null;
            if (empty($terms)) {
                $terms = array('1' => (object) array('name' => 'nothing', 'slug' => 'none'));
            }
            foreach ($terms as $term) {
                $project_cat = strtolower($term->slug);
            }
            $postlist_args = array('posts_per_page' => -1, 'orderby' => 'menu_order title', 'order' => 'ASC', 'post_type' => 'portfolio', 'project-type' => $project_cat);
            $postlist = get_posts($postlist_args);
            // get ids of posts retrieved from get_posts
            $ids = array();
            foreach ($postlist as $thepost) {
                $ids[] = $thepost->ID;
            }
            // get and echo previous and next post in the same taxonomy
            $thisindex = array_search($post->ID, $ids);
            $previd = isset($ids[$thisindex - 1]) ? $ids[$thisindex - 1] : null;
            $nextid = isset($ids[$thisindex + 1]) ? $ids[$thisindex + 1] : null;
            if (!empty($previd)) {
                if ($single_nav_pos == 'after_project') {
                    echo '<li id="prev-link" class="from-sing"><a href="' . get_permalink($previd) . '"><i class="icon-angle-left"></i><span>' . __('Previous Project', NECTAR_THEME_NAME) . '</span></a></li>';
                } else {
                    echo '<li id="prev-link" class="from-sing"><a href="' . get_permalink($previd) . '"><i class="icon-salient-left-arrow-thin"></i></a></li>';
                }
            }
            if (!empty($nextid)) {
                if ($single_nav_pos == 'after_project') {
                    echo '<li id="next-link" class="from-sing"><a href="' . get_permalink($nextid) . '"><span>' . __('Next Project', NECTAR_THEME_NAME) . '</span><i class="icon-angle-right"></i></a></li>';
                } else {
                    echo '<li id="next-link" class="from-sing"><a href="' . get_permalink($nextid) . '"><i class="icon-salient-right-arrow-thin"></i></a></li>';
                }
            }
        } else {
            ?>
						<?php 
            if ($single_nav_pos == 'after_project') {
                ?>
							<li id="prev-link"><?php 
                next_post_link('%link', '<i class="icon-angle-left"></i><span>' . __('Previous Project', NECTAR_THEME_NAME) . '</span>');
                ?>
</li>
							<li id="next-link"><?php 
                previous_post_link('%link', '<span>' . __('Next Project', NECTAR_THEME_NAME) . '</span><i class="icon-angle-right"></i>');
                ?>
</li> 
						<?php 
            } else {
                ?>
 
							<li id="prev-link"><?php 
                next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>');
                if ($single_nav_pos == 'after_project') {
                    echo __('Previous Project', NECTAR_THEME_NAME);
                }
                ?>
</li>
							<li id="next-link"><?php 
                if ($single_nav_pos == 'after_project') {
                    echo __('Next Project', NECTAR_THEME_NAME);
                }
                previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>');
                ?>
</li> 
						<?php 
            }
            ?>

					<?php 
        }
        ?>
                                   
				</ul>
			</div>
	 <?php 
    }
}
Esempio n. 5
0
    function nectar_page_header($postid)
    {
        global $options;
        global $post;
        global $nectar_theme_skin;
        $bg = get_post_meta($postid, '_nectar_header_bg', true);
        $bg_color = get_post_meta($postid, '_nectar_header_bg_color', true);
        $font_color = get_post_meta($postid, '_nectar_header_font_color', true);
        $parallax_bg = get_post_meta($postid, '_nectar_header_parallax', true);
        $title = get_post_meta($postid, '_nectar_header_title', true);
        $subtitle = get_post_meta($postid, '_nectar_header_subtitle', true);
        $height = get_post_meta($postid, '_nectar_header_bg_height', true);
        $page_template = get_post_meta($postid, '_wp_page_template', true);
        $display_sortable = get_post_meta($postid, 'nectar-metabox-portfolio-display-sortable', true);
        $inline_filters = !empty($options['portfolio_inline_filters']) && $options['portfolio_inline_filters'] == '1' ? '1' : '0';
        $filters_id = !empty($options['portfolio_inline_filters']) && $options['portfolio_inline_filters'] == '1' ? 'portfolio-filters-inline' : 'portfolio-filters';
        $text_align = get_post_meta($postid, '_nectar_page_header_alignment', true);
        $fullscreen_header = !empty($options['blog_header_type']) && $options['blog_header_type'] == 'fullscreen' && is_singular('post') ? true : false;
        $bottom_shadow = get_post_meta($postid, '_nectar_header_bottom_shadow', true);
        $bg_overlay = get_post_meta($postid, '_nectar_header_overlay', true);
        !empty($display_sortable) && $display_sortable == 'on' ? $display_sortable = '1' : ($display_sortable = '0');
        //incase no title is entered for portfolio, still show the filters
        if ($page_template == 'template-portfolio.php' && empty($title)) {
            $title = get_the_title($post->ID);
        }
        if (!empty($bg) || !empty($bg_color)) {
            empty($bg) ? $social_img_src = 'none' : ($social_img_src = $bg);
            empty($bg) ? $bg = 'none' : ($bg = 'url(' . $bg . ')');
            empty($bg_color) ? $bg_color = '#000' : ($bg_color = $bg_color);
            $height = !empty($height) ? preg_replace('/\\s+/', '', $height) : $height;
            $not_loaded_class = $nectar_theme_skin != 'ascend' ? "not-loaded" : null;
            $fullscreen_class = $fullscreen_header == true ? "fullscreen-header" : null;
            $bottom_shadow_class = $bottom_shadow == 'on' ? " bottom-shadow" : null;
            $bg_overlay_class = $bg_overlay == 'on' ? " bg-overlay" : null;
            $ajax_page_loading = !empty($options['ajax-page-loading']) && $options['ajax-page-loading'] == '1' ? true : false;
            $wrapper_height_style = $fullscreen_header == true && ($post->post_type == 'post' && is_single()) || $ajax_page_loading == false ? null : 'style="height: ' . $height . 'px;"';
            if (!empty($parallax_bg) && $parallax_bg == 'on') {
                echo '<div id="page-header-wrap" class="' . $fullscreen_class . '" ' . $wrapper_height_style . '>';
            }
            ?>
	    <div class="<?php 
            echo $not_loaded_class . ' ' . $fullscreen_class . $bottom_shadow_class . $bg_overlay_class;
            ?>
" id="page-header-bg" data-alignment="<?php 
            echo !empty($text_align) ? $text_align : 'left';
            ?>
" data-parallax="<?php 
            echo !empty($parallax_bg) && $parallax_bg == 'on' ? '1' : '0';
            ?>
" data-height="<?php 
            echo !empty($height) ? $height : '350';
            ?>
" style="background-color: <?php 
            echo $bg_color;
            ?>
; background-image: <?php 
            echo nectar_options_img($bg);
            ?>
; height: <?php 
            echo $height;
            ?>
px;">
			

			<div class="container">	
			
					<?php 
            if ($post->ID != 0 && $post->post_type && $post->post_type == 'portfolio') {
                ?>
					
					<div class="row project-title">
					<div class="container">
					<div class="col span_6 section-title <?php 
                if (empty($options['portfolio_social']) || $options['portfolio_social'] == 0 || empty($options['portfolio_date']) || $options['portfolio_date'] == 0) {
                    echo 'no-date';
                }
                ?>
">
						
						<h1><?php 
                the_title();
                ?>
</h1>
						
						<?php 
                $options = get_option('salient');
                $back_to_all_override = get_post_meta($post->ID, 'nectar-metabox-portfolio-parent-override', true);
                if (empty($back_to_all_override)) {
                    $back_to_all_override = 'default';
                }
                //attempt to find parent portfolio page - if unsuccessful default to main portfolio page
                global $post;
                $terms = get_the_terms($post->id, "project-type");
                $project_cat = null;
                $portfolio_link = null;
                if (empty($terms)) {
                    $terms = array('1' => (object) array('name' => 'nothing'));
                }
                foreach ($terms as $term) {
                    $project_cat = strtolower($term->name);
                }
                $page = get_page_by_title_search($project_cat);
                if (empty($page)) {
                    $page = array('0' => (object) array('ID' => 'nothing'));
                }
                $page_link = verify_portfolio_page($page[0]->ID);
                //if a page has been found for the category
                if (!empty($page_link) && $back_to_all_override == 'default') {
                    $portfolio_link = $page_link;
                    ?>
							 
							 <div id="portfolio-nav">
							 	<ul>
							 		<li id="all-items"><a href="<?php 
                    echo $portfolio_link;
                    ?>
"><i class="icon-salient-back-to-all"></i></a></li>               
							 	</ul>
								<ul class="controls">                                 
									<li id="prev-link"><?php 
                    be_next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>', TRUE, null, 'project-type');
                    ?>
</li>
									<li id="next-link"><?php 
                    be_previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>', TRUE, null, 'project-type');
                    ?>
</li> 
								</ul>
							</div>
							 
					<?php 
                } else {
                    $portfolio_link = get_portfolio_page_link(get_the_ID());
                    if (!empty($options['main-portfolio-link'])) {
                        $portfolio_link = $options['main-portfolio-link'];
                    }
                    if ($back_to_all_override != 'default') {
                        $portfolio_link = get_page_link($back_to_all_override);
                    }
                    ?>
							
							<div id="portfolio-nav">
								<ul>
									<li id="all-items"><a href="<?php 
                    echo $portfolio_link;
                    ?>
"><i class="icon-salient-back-to-all"></i></a></li>  
								</ul>
								<ul class="controls">                                       
									<?php 
                    if (!empty($options['portfolio_same_category_single_nav']) && $options['portfolio_same_category_single_nav'] == '1') {
                        ?>
											<li id="prev-link"><?php 
                        be_next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>');
                        ?>
</li>
											<li id="next-link"><?php 
                        be_previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>');
                        ?>
</li> 
										<?php 
                    } else {
                        ?>
											<li id="prev-link"><?php 
                        next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>');
                        ?>
</li>
											<li id="next-link"><?php 
                        previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>');
                        ?>
</li> 
										<?php 
                    }
                    ?>
								</ul>
							</div>
					 <?php 
                }
                ?>
						
					</div>
				</div> 
			
			</div><!--/row-->
						
						
						
						
						
						
						
					<?php 
            } elseif ($post->ID != 0 && $post->post_type == 'post' && is_single()) {
                // also set as an img for social sharing/
                if ($social_img_src != 'none') {
                    echo '<img class="hidden-social-img" src="' . $social_img_src . '" alt="' . get_the_title() . '" />';
                }
                ?>
						
						<div class="row">
						<div class="col span_6 section-title blog-title">
							<h1 class="entry-title"><?php 
                the_title();
                ?>
</h1>

							 <?php 
                if ($post->post_type == 'post' && is_single() && $fullscreen_header == true) {
                    ?>
							 	<div class="author-section">
								 	<span class="meta-author vcard author">  
								 		<?php 
                    if (function_exists('get_avatar')) {
                        echo get_avatar(get_the_author_meta('email'), 100);
                    }
                    ?>
								 	</span> 
								 	<div class="avatar-post-info">
									 	<span class="fn"><?php 
                    the_author_posts_link();
                    ?>
</span>
									 	<span class="meta-date date updated"><i><?php 
                    echo get_the_date();
                    ?>
</i></span>
									 </div>
								</div>
							<?php 
                }
                ?>
							
							<?php 
                if ($fullscreen_header != true) {
                    ?>

								<div id="single-below-header">
									<span class="meta-author vcard author"><span class="fn"><?php 
                    echo __('By', NECTAR_THEME_NAME);
                    ?>
 <?php 
                    the_author_posts_link();
                    ?>
</span></span> 
									<?php 
                    if (!empty($options['blog_social']) && $options['blog_social'] == 1) {
                        ?>
										<span class="meta-date date updated"><?php 
                        echo get_the_date();
                        ?>
</span>
									<?php 
                    }
                    ?>
									<span class="meta-category"><?php 
                    the_category(', ');
                    ?>
</span>
									<span class="meta-comment-count"><a href="<?php 
                    comments_link();
                    ?>
"><?php 
                    comments_number(__('No Comments', NECTAR_THEME_NAME), __('One Comment ', NECTAR_THEME_NAME), __('% Comments', NECTAR_THEME_NAME));
                    ?>
</a></span>
								
								</div><!--/single-below-header-->
								
								<div id="single-meta" data-sharing="<?php 
                    echo !empty($options['blog_social']) && $options['blog_social'] == 1 ? '1' : '0';
                    ?>
">
									<ul>
		
										<?php 
                    if (empty($options['blog_social']) || $options['blog_social'] == 0) {
                        ?>
											   	
											   	<li>
											   		<?php 
                        echo '<span class="n-shortcode">' . nectar_love('return') . '</span>';
                        ?>
											   	</li>
												<li>
													<?php 
                        echo get_the_date();
                        ?>
												</li>
										
										<?php 
                    }
                    ?>
			
									</ul>
									
									<?php 
                    if (!empty($options['blog_social']) && $options['blog_social'] == 1) {
                        echo '<div class="nectar-social">';
                        echo '<span class="n-shortcode">' . nectar_love('return') . '</span>';
                        //facebook
                        if (!empty($options['blog-facebook-sharing']) && $options['blog-facebook-sharing'] == 1) {
                            echo "<a class='facebook-share nectar-sharing' href='#' title='" . __('Share this', NECTAR_THEME_NAME) . "'> <i class='icon-facebook'></i> <span class='count'></span></a>";
                        }
                        //twitter
                        if (!empty($options['blog-twitter-sharing']) && $options['blog-twitter-sharing'] == 1) {
                            echo "<a class='twitter-share nectar-sharing' href='#' title='" . __('Tweet this', NECTAR_THEME_NAME) . "'> <i class='icon-twitter'></i> <span class='count'></span></a>";
                        }
                        //google plus
                        if (!empty($options['blog-google-plus-sharing']) && $options['blog-google-plus-sharing'] == 1) {
                            echo "<a class='google-plus-share nectar-sharing-alt' href='#' title='" . __('Share this', NECTAR_THEME_NAME) . "'> <i class='icon-google-plus'></i> <span class='count'> " . GetGooglePlusShares(get_permalink($post->ID)) . " </span></a>";
                        }
                        //linkedIn
                        if (!empty($options['blog-linkedin-sharing']) && $options['blog-linkedin-sharing'] == 1) {
                            echo "<a class='linkedin-share nectar-sharing' href='#' title='" . __('Share this', NECTAR_THEME_NAME) . "'> <i class='icon-linkedin'></i> <span class='count'> </span></a>";
                        }
                        //pinterest
                        if (!empty($options['blog-pinterest-sharing']) && $options['blog-pinterest-sharing'] == 1) {
                            echo "<a class='pinterest-share nectar-sharing' href='#' title='" . __('Pin this', NECTAR_THEME_NAME) . "'> <i class='icon-pinterest'></i> <span class='count'></span></a>";
                        }
                        echo '</div>';
                    }
                    ?>
									
								</div><!--/single-meta-->

							<?php 
                }
                //end if theme skin default
                ?>

						</div><!--/section-title-->
					</div><!--/row-->
						
							
						
						
					
					<?php 
                //default
            } else {
                ?>
					 <div class="row">
						<div class="col span_6">
							<h1><?php 
                echo $title;
                ?>
</h1>
							<span class="subheader"><?php 
                echo $subtitle;
                ?>
</span>
						</div>
						 
						<?php 
                // portfolio filters
                if ($page_template == 'template-portfolio.php' && $display_sortable == '1' && $inline_filters == '0') {
                    ?>
							<div id="<?php 
                    echo $filters_id;
                    ?>
">
									<a href="#" data-sortable-label="<?php 
                    echo !empty($options['portfolio-sortable-text']) ? $options['portfolio-sortable-text'] : 'Sort Portfolio';
                    ?>
" id="sort-portfolio"><span><?php 
                    echo !empty($options['portfolio-sortable-text']) ? $options['portfolio-sortable-text'] : __('Sort Portfolio', NECTAR_THEME_NAME);
                    ?>
</span> <i class="icon-angle-down"></i></a> 
								<ul>
								   <li><a href="#" data-filter="*"><?php 
                    echo __('All', NECTAR_THEME_NAME);
                    ?>
</a></li>
				               	   <?php 
                    wp_list_categories(array('title_li' => '', 'taxonomy' => 'project-type', 'show_option_none' => '', 'walker' => new Walker_Portfolio_Filter()));
                    ?>
								</ul>
							</div>
						<?php 
                }
                ?>
						
					  </div>
					  
					  
				<?php 
            }
            ?>
					
					
				
			</div>


			 <?php 
            if ($post->ID != 0 && $post->post_type == 'post' && is_single() && $fullscreen_header == true) {
                ?>
				<a href="#" class="section-down-arrow"><i class="icon-salient-down-arrow icon-default-style"> </i></a>
			<?php 
            }
            ?>


		</div>


	   <?php 
            if (!empty($parallax_bg) && $parallax_bg == 'on') {
                echo '</div>';
            }
            ?>


	    <?php 
        } else {
            if (!empty($title)) {
                ?>
	    	
		    <div class="row page-header-no-bg" data-alignment="<?php 
                echo !empty($text_align) ? $text_align : 'left';
                ?>
">
		    	<div class="container">	
					<div class="col span_12 section-title">
						<h1><?php 
                echo $title;
                if (!empty($subtitle)) {
                    echo '<span>' . $subtitle . '</span>';
                }
                ?>
</h1>
						
						<?php 
                // portfolio filters
                if ($page_template == 'template-portfolio.php' && $display_sortable == '1' && $inline_filters == '0') {
                    ?>
						<div id="<?php 
                    echo $filters_id;
                    ?>
">
							
							<a href="#" data-sortable-label="<?php 
                    echo !empty($options['portfolio-sortable-text']) ? $options['portfolio-sortable-text'] : 'Sort Portfolio';
                    ?>
" id="sort-portfolio"><span><?php 
                    echo !empty($options['portfolio-sortable-text']) ? $options['portfolio-sortable-text'] : __('Sort Portfolio', NECTAR_THEME_NAME);
                    ?>
</span> <i class="icon-angle-down"></i></a> 
							
							<ul>
							   <li><a href="#" data-filter="*"><?php 
                    echo __('All', NECTAR_THEME_NAME);
                    ?>
</a></li>
			               	   <?php 
                    wp_list_categories(array('title_li' => '', 'taxonomy' => 'project-type', 'show_option_none' => '', 'walker' => new Walker_Portfolio_Filter()));
                    ?>
							</ul>
						</div>
					<?php 
                }
                ?>
						
					</div>
				</div>



			</div>
	    	
	   <?php 
            }
        }
    }
Esempio n. 6
0
function nectar_recent_projects($atts, $content = null)
{
    extract(shortcode_atts(array("title_labels" => 'false', 'project_style' => '', 'heading' => '', 'page_link_text' => '', 'page_link_url' => '', 'hide_controls' => 'false', 'lightbox_only' => '0', 'number_to_display' => '6', 'full_width' => 'false', 'category' => 'all'), $atts));
    global $post;
    global $options;
    global $nectar_love;
    $options = get_option('salient');
    $title_label_output = null;
    $recent_projects_title_text = !empty($options['carousel-title']) ? $options['carousel-title'] : 'Recent Work';
    $recent_projects_link_text = !empty($options['carousel-link']) ? $options['carousel-link'] : 'View All Work';
    $portfolio_link = get_portfolio_page_link(get_the_ID());
    if (!empty($options['main-portfolio-link'])) {
        $portfolio_link = $options['main-portfolio-link'];
    }
    //project style
    if (empty($project_style) && $full_width == 'true') {
        $project_style = '2';
    } elseif (empty($project_style) && $full_width == 'false') {
        $project_style = '1';
    }
    $full_width_carousel = $full_width == 'true' ? 'true' : 'false';
    //incase only all was selected
    if ($category == 'all') {
        $category = null;
    }
    $projects_to_display = intval($number_to_display) == 0 ? '6' : $number_to_display;
    if (!empty($heading)) {
        if ($full_width_carousel == 'true') {
            $title_label_output = '<h2>' . $heading . '</h2>';
        } else {
            $title_label_output = '<h2>' . $heading . '<a href="' . $page_link_url . '" class="button"> / ' . $page_link_text . '</a></h2>';
        }
    }
    //keep old label option to not break legacy users
    if ($title_labels == 'true') {
        $title_label_output = '<h2>' . $recent_projects_title_text . '<a href="' . $portfolio_link . '" class="button"> / ' . $recent_projects_link_text . '</a></h2>';
    }
    $portfolio = array('posts_per_page' => $projects_to_display, 'post_type' => 'portfolio', 'project-type' => $category);
    $the_query = new WP_Query($portfolio);
    if ($full_width_carousel == 'true') {
        $arrow_markup = '<div class="controls"><a class="portfolio-page-link" href="' . $page_link_url . '"><i class="icon-salient-back-to-all"></i></a>
									 <a class="carousel-prev" href="#"><i class="icon-salient-left-arrow-thin"></i></a>
					    	         <a class="carousel-next" href="#"><i class="icon-salient-right-arrow-thin"></i></a></div>';
    } else {
        $arrow_markup = '<a class="carousel-prev" href="#"><i class="icon-angle-left"></i></a>
					    	         <a class="carousel-next" href="#"><i class="icon-angle-right"></i></a>';
    }
    if ($hide_controls == 'true') {
        $arrow_markup = null;
    }
    ?>
 
				
				<?php 
    if ($the_query->have_posts()) {
        $default_style = $project_style == '1' ? 'default-style' : null;
        $recent_projects_content = '<div class="carousel-wrap recent-work-carousel ' . $default_style . '" data-full-width="' . $full_width_carousel . '">
					
					<div class="carousel-heading"><div class="container">' . $title_label_output . $arrow_markup . '</div></div>
					
					<ul class="row portfolio-items text-align-center carousel" data-scroll-speed="800" data-easing="easeInOutQuart">';
    }
    //standard layout
    if ($project_style == '1') {
        if ($the_query->have_posts()) {
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                $video_embed = get_post_meta($post->ID, '_nectar_video_embed', true);
                $video_m4v = get_post_meta($post->ID, '_nectar_video_m4v', true);
                $media = null;
                $date = null;
                $love = $nectar_love->add_love();
                $custom_project_link = get_post_meta($post->ID, '_nectar_external_project_url', true);
                $the_project_link = !empty($custom_project_link) ? $custom_project_link : get_permalink();
                //video
                if (!empty($video_embed) || !empty($video_m4v)) {
                    if (!empty($video_embed) && floatval(get_bloginfo('version')) < "3.6") {
                        $media .= '<a href="#video-popup-' . $post->ID . '" class="pretty_photo">' . __("Watch Video", NECTAR_THEME_NAME) . ' </a> ';
                        $media .= '<div id="video-popup-' . $post->ID . '">';
                        $media .= '<div class="video-wrap">' . stripslashes(htmlspecialchars_decode($video_embed)) . '</div>';
                        $media .= '</div>';
                    } else {
                        $media .= '<a href="' . get_template_directory_uri() . '/includes/portfolio-functions/video.php?post-id=' . $post->ID . '&iframe=true&width=854" class="pretty_photo" >' . __("Watch Video", NECTAR_THEME_NAME) . '</a> ';
                    }
                } else {
                    $media .= '<a href="' . $featured_image[0] . '" class="pretty_photo">' . __("View Larger", NECTAR_THEME_NAME) . '</a> ';
                }
                $project_excerpt = get_post_meta($post->ID, '_nectar_project_excerpt', true);
                if (!empty($project_excerpt)) {
                    $date = '<p>' . $project_excerpt . '</p>';
                } elseif (!empty($options['portfolio_date']) && $options['portfolio_date'] == 1) {
                    $date = '<p>' . get_the_date() . '</p>';
                }
                $project_img = '<img src="' . get_template_directory_uri() . '/img/no-portfolio-item-small.jpg" alt="no image added yet." />';
                if (has_post_thumbnail()) {
                    $project_img = get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => ''));
                }
                //custom thumbnail
                $custom_thumbnail = get_post_meta($post->ID, '_nectar_portfolio_custom_thumbnail', true);
                if (!empty($custom_thumbnail)) {
                    $project_img = '<img class="custom-thumbnail" src="' . $custom_thumbnail . '" alt="' . get_the_title() . '" />';
                }
                $more_details_html = $lightbox_only != 'true' ? '<a href="' . $the_project_link . '">' . __("More Details", NECTAR_THEME_NAME) . '</a>' : null;
                $project_accent_color = get_post_meta($post->ID, '_nectar_project_accent_color', true);
                if (!empty($project_accent_color)) {
                    $project_accent_color_markup = 'data-project-color="' . $project_accent_color . '"';
                } else {
                    $project_accent_color_markup = 'data-default-color="true"';
                }
                $recent_projects_content .= '<li class="col span_4" ' . $project_accent_color_markup . '>
							
							<div class="work-item">' . $project_img . '
			
								<div class="work-info-bg"></div>
								<div class="work-info">
									
									<div class="vert-center">' . $media . $more_details_html . '
		
									</div><!--/vert-center-->
									
								</div>
							</div><!--work-item-->
							
							<div class="work-meta">
								<h4 class="title"> ' . get_the_title() . '</h4>
								' . $date . '
							</div><div class="nectar-love-wrap">
							
							' . $love . '</div>
							
							<div class="clear"></div>
							
						</li><!--/span_4-->';
            }
        }
    } elseif ($project_style == '2') {
        if ($the_query->have_posts()) {
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                $video_embed = get_post_meta($post->ID, '_nectar_video_embed', true);
                $video_m4v = get_post_meta($post->ID, '_nectar_video_m4v', true);
                $media = null;
                $date = null;
                $love = $nectar_love->add_love();
                $margin = $full_width_carousel == 'true' ? 'no-margin' : null;
                $custom_project_link = get_post_meta($post->ID, '_nectar_external_project_url', true);
                $the_project_link = !empty($custom_project_link) ? $custom_project_link : get_permalink();
                $project_excerpt = get_post_meta($post->ID, '_nectar_project_excerpt', true);
                if (!empty($project_excerpt)) {
                    $date = '<p>' . $project_excerpt . '</p>';
                } elseif (!empty($options['portfolio_date']) && $options['portfolio_date'] == 1) {
                    $date = '<p>' . get_the_date() . '</p>';
                }
                $project_img = '<img src="' . get_template_directory_uri() . '/img/no-portfolio-item-small.jpg" alt="no image added yet." />';
                if (has_post_thumbnail()) {
                    $project_img = get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => ''));
                }
                //custom thumbnail
                $custom_thumbnail = get_post_meta($post->ID, '_nectar_portfolio_custom_thumbnail', true);
                if (!empty($custom_thumbnail)) {
                    $project_img = '<img class="custom-thumbnail" src="' . $custom_thumbnail . '" alt="' . get_the_title() . '" />';
                }
                if ($lightbox_only != 'true') {
                    $link_markup = '<a href="' . $the_project_link . '"></a>';
                } else {
                    //video
                    if (!empty($video_embed) || !empty($video_m4v)) {
                        if (!empty($video_embed) && floatval(get_bloginfo('version')) < "3.6") {
                            $link_markup = '<a href="#video-popup-' . $post->ID . '" class="pretty_photo"> </a> ';
                            $link_markup .= '<div id="video-popup-' . $post->ID . '">';
                            $link_markup .= '<div class="video-wrap">' . stripslashes(htmlspecialchars_decode($video_embed)) . '</div>';
                            $link_markup .= '</div>';
                        } else {
                            $link_markup = '<a href="' . get_template_directory_uri() . '/includes/portfolio-functions/video.php?post-id=' . $post->ID . '&iframe=true&width=854" class="pretty_photo" ></a> ';
                        }
                    } else {
                        $link_markup = '<a href="' . $featured_image[0] . '" class="pretty_photo"></a>';
                    }
                }
                $project_accent_color = get_post_meta($post->ID, '_nectar_project_accent_color', true);
                if (!empty($project_accent_color)) {
                    $project_accent_color_markup = 'data-project-color="' . $project_accent_color . '"';
                } else {
                    $project_accent_color_markup = 'data-default-color="true"';
                }
                $recent_projects_content .= '<li class="col span_4 ' . $margin . '" ' . $project_accent_color_markup . '>
							
							<div class="work-item style-2">' . $project_img . '
			
								<div class="work-info-bg"></div>
								<div class="work-info">
									
									<i class="icon-salient-plus"></i> 
									
									' . $link_markup . '

									<div class="vert-center"><h3>' . get_the_title() . '</h3> ' . $date . '</div><!--/vert-center-->
									
								</div>
							</div><!--work-item-->

						</li><!--/span_4-->';
            }
        }
    } elseif ($project_style == '3') {
        if ($the_query->have_posts()) {
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                $video_embed = get_post_meta($post->ID, '_nectar_video_embed', true);
                $video_m4v = get_post_meta($post->ID, '_nectar_video_m4v', true);
                $media = null;
                $date = null;
                $love = $nectar_love->add_love();
                $margin = $full_width_carousel == 'true' ? 'no-margin' : null;
                $custom_project_link = get_post_meta($post->ID, '_nectar_external_project_url', true);
                $the_project_link = !empty($custom_project_link) ? $custom_project_link : get_permalink();
                $project_excerpt = get_post_meta($post->ID, '_nectar_project_excerpt', true);
                if (!empty($project_excerpt)) {
                    $date = '<p>' . $project_excerpt . '</p>';
                } elseif (!empty($options['portfolio_date']) && $options['portfolio_date'] == 1) {
                    $date = '<p>' . get_the_date() . '</p>';
                }
                $project_img = '<img src="' . get_template_directory_uri() . '/img/no-portfolio-item-small.jpg" alt="no image added yet." />';
                if (has_post_thumbnail()) {
                    $project_img = get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => ''));
                }
                //custom thumbnail
                $custom_thumbnail = get_post_meta($post->ID, '_nectar_portfolio_custom_thumbnail', true);
                if (!empty($custom_thumbnail)) {
                    $project_img = '<img class="custom-thumbnail" src="' . $custom_thumbnail . '" alt="' . get_the_title() . '" />';
                }
                if ($lightbox_only != 'true') {
                    $link_markup = '<a href="' . $the_project_link . '"></a>';
                } else {
                    //video
                    if (!empty($video_embed) || !empty($video_m4v)) {
                        if (!empty($video_embed) && floatval(get_bloginfo('version')) < "3.6") {
                            $link_markup = '<a href="#video-popup-' . $post->ID . '" class="pretty_photo"> </a> ';
                            $link_markup .= '<div id="video-popup-' . $post->ID . '">';
                            $link_markup .= '<div class="video-wrap">' . stripslashes(htmlspecialchars_decode($video_embed)) . '</div>';
                            $link_markup .= '</div>';
                        } else {
                            $link_markup = '<a href="' . get_template_directory_uri() . '/includes/portfolio-functions/video.php?post-id=' . $post->ID . '&iframe=true&width=854" class="pretty_photo" ></a> ';
                        }
                    } else {
                        $link_markup = '<a href="' . $featured_image[0] . '" class="pretty_photo"></a>';
                    }
                }
                $project_accent_color = get_post_meta($post->ID, '_nectar_project_accent_color', true);
                if (!empty($project_accent_color)) {
                    $project_accent_color_markup = 'data-project-color="' . $project_accent_color . '"';
                } else {
                    $project_accent_color_markup = 'data-default-color="true"';
                }
                $recent_projects_content .= '<li class="col span_4 ' . $margin . '" ' . $project_accent_color_markup . '>
								
								<div class="work-item style-3">' . $project_img . '
				
									<div class="work-info-bg"></div>
									<div class="work-info">
										
										' . $link_markup . '
	
										<div class="vert-center"><h3>' . get_the_title() . '</h3>' . $date . '</div><!--/vert-center-->
										
									</div>
								</div><!--work-item-->
	
							</li><!--/span_4-->';
            }
        }
    } elseif ($project_style == '4') {
        if ($the_query->have_posts()) {
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                $video_embed = get_post_meta($post->ID, '_nectar_video_embed', true);
                $video_m4v = get_post_meta($post->ID, '_nectar_video_m4v', true);
                $media = null;
                $date = null;
                $love = $nectar_love->add_love();
                $margin = $full_width_carousel == 'true' ? 'no-margin' : null;
                $custom_project_link = get_post_meta($post->ID, '_nectar_external_project_url', true);
                $the_project_link = !empty($custom_project_link) ? $custom_project_link : get_permalink();
                $project_excerpt = get_post_meta($post->ID, '_nectar_project_excerpt', true);
                if (!empty($project_excerpt)) {
                    $date = '<p>' . $project_excerpt . '</p>';
                } elseif (!empty($options['portfolio_date']) && $options['portfolio_date'] == 1) {
                    $date = '<p>' . get_the_date() . '</p>';
                }
                $project_img = '<img src="' . get_template_directory_uri() . '/img/no-portfolio-item-small.jpg" alt="no image added yet." />';
                if (has_post_thumbnail()) {
                    $project_img = get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => ''));
                }
                //custom thumbnail
                $custom_thumbnail = get_post_meta($post->ID, '_nectar_portfolio_custom_thumbnail', true);
                if (!empty($custom_thumbnail)) {
                    $project_img = '<img class="custom-thumbnail" src="' . $custom_thumbnail . '" alt="' . get_the_title() . '" />';
                }
                if ($lightbox_only != 'true') {
                    $link_markup = '<a href="' . $the_project_link . '"></a>';
                } else {
                    //video
                    if (!empty($video_embed) || !empty($video_m4v)) {
                        if (!empty($video_embed) && floatval(get_bloginfo('version')) < "3.6") {
                            $link_markup = '<a href="#video-popup-' . $post->ID . '" class="pretty_photo"> </a> ';
                            $link_markup .= '<div id="video-popup-' . $post->ID . '">';
                            $link_markup .= '<div class="video-wrap">' . stripslashes(htmlspecialchars_decode($video_embed)) . '</div>';
                            $link_markup .= '</div>';
                        } else {
                            $link_markup = '<a href="' . get_template_directory_uri() . '/includes/portfolio-functions/video.php?post-id=' . $post->ID . '&iframe=true&width=854" class="pretty_photo" ></a> ';
                        }
                    } else {
                        $link_markup = '<a href="' . $featured_image[0] . '" class="pretty_photo"></a>';
                    }
                }
                $project_accent_color = get_post_meta($post->ID, '_nectar_project_accent_color', true);
                if (!empty($project_accent_color)) {
                    $project_accent_color_markup = 'data-project-color="' . $project_accent_color . '"';
                } else {
                    $project_accent_color_markup = 'data-default-color="true"';
                }
                $recent_projects_content .= '<li class="col span_4 ' . $margin . '" ' . $project_accent_color_markup . '>
								
								<div class="work-item style-4">' . $project_img . '
				
									<div class="work-info">
										
										' . $link_markup . '
	
										<div class="bottom-meta"><h3>' . get_the_title() . '</h3>' . $date . '</div><!--/bottom-meta-->
										
									</div>
								</div><!--work-item-->
	
							</li><!--/span_4-->';
            }
        }
    }
    //project style 4
    if ($the_query->have_posts()) {
        $recent_projects_content .= '</ul><!--/carousel--></div><!--/carousel-wrap-->';
    }
    wp_reset_postdata();
    return $recent_projects_content;
}
Esempio n. 7
0
function portfolio_front_page()
{
    global $wpGrade_Options, $post;
    //show only 3 on the home page by default
    $number = 6;
    //	if ($wpGrade_Options->get('homepage_portfolio_limit'))
    //	{
    //		$number = absint($wpGrade_Options->get('homepage_portfolio_limit'));
    //	}
    //the width/height ratio of the sizes
    $portfolio_ratios = array('long' => 2.592, 'tall' => 0.649, 'small' => 1.299);
    //the patterns for 6 portfolio items, 3 per row, with 9 columns grid
    $portfolio_patterns = array(array('small', 'long', 'big', 'tall'), array('big', 'tall', 'small', 'long'), array('long', 'small', 'small', 'big', 'small'), array('long', 'small', 'tall', 'big'), array('small', 'big', 'small', 'long', 'small'), array('long', 'small', 'tall', 'big'));
    //$featured_query = new WP_Query( array('post_type' => 'portfolio', 'posts_per_page' => $number));
    $query_args = array('post_type' => 'portfolio', 'posts_per_page' => $number, 'meta_key' => '_senna_portfolio_featured', 'orderby' => 'meta_value date', 'meta_query' => array('relation' => 'AND', array('key' => '_senna_portfolio_featured', 'compare' => '=', 'value' => 'on')));
    $featured_projects = get_posts($query_args);
    // if we don't have enough featured posts we fill them with reqular posts
    if (count($featured_projects) < $number) {
        $squery_args = array('post_type' => 'portfolio', 'posts_per_page' => $number - count($featured_projects), 'orderby' => 'date', 'meta_query' => array('relation' => 'OR', array('key' => '_senna_portfolio_featured', 'compare' => '!=', 'value' => 'on'), array('key' => '_senna_portfolio_featured', 'compare' => 'NOT EXISTS', 'value' => '')));
        $regular_projects = get_posts($squery_args);
        $featured_projects = array_merge($featured_projects, $regular_projects);
    }
    ?>

	<div class="row portfolio_frontpage portfolio_items">

		<?php 
    /* Start the Loop */
    $counter = 0;
    foreach ($featured_projects as $key => $post) {
        setup_postdata($post);
        ?>

			<?php 
        if ($counter < $number) {
            ?>

				<article id="post-<?php 
            the_ID();
            ?>
" <?php 
            post_class();
            ?>
>

				  <ul>

				<?php 
            // get the big image
            $video_markup = get_post_format() == 'video' ? '<div class="video_icon"><span></span></div>' : '';
            $video_class = get_post_format() == 'video' ? 'video_type' : '';
            $video_poster = get_post_meta(get_the_ID(), '_senna_video_poster', true);
            if (!empty($video_poster)) {
                global $wpdb;
                $uploads_dir_info = wp_upload_dir();
                $temp_poster = str_replace($uploads_dir_info['baseurl'] . '/', '', $video_poster);
                $featured_image_id = $wpdb->get_var($wpdb->prepare("SELECT wposts.ID FROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $temp_poster));
                if (!empty($featured_image_id)) {
                    //get the rest of the gallery without the featured image
                    $attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID(), 'exclude' => $featured_image_id));
                } else {
                    //get the gallery
                    $attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID()));
                }
            } elseif (has_post_thumbnail(get_the_ID())) {
                $featured_image_id = get_post_thumbnail_id(get_the_ID());
                //get the rest of the gallery without the featured image
                $attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID(), 'exclude' => $featured_image_id));
            } else {
                //get all the images in the gallery
                $attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID()));
                //we use the first image in the gallery for the big one
                if (!empty($attachments[0])) {
                    $featured_image_id = $attachments[0]->ID;
                    //delete the first image from the array
                    array_shift($attachments);
                }
            }
            if (!empty($attachments)) {
                //make an array with images url, width, height and ratio of width/height
                $attachment_images = array();
                foreach ($attachments as $attachment) {
                    $attachment_images[$attachment->ID] = wp_get_attachment_image_src($attachment->ID, 'full');
                    $attachment_images[$attachment->ID]['ratio'] = $attachment_images[$attachment->ID][1] / $attachment_images[$attachment->ID][2];
                }
                //lets go through the pattern and find the right images for each position
                $pattern_counter = 0;
                foreach ($portfolio_patterns[$counter % 6] as $pattern) {
                    //if it's not the big one, we've found that earlier
                    if ($pattern != 'big') {
                        //if we still have images
                        if (!empty($attachment_images)) {
                            //put the "Portfolio" box
                            if ($counter == 0 && $pattern == 'long') {
                                echo '<li class="' . $pattern . ' text big-portfolio" >

												<a href="' . get_portfolio_page_link() . '">

													<div class="title"><div>' . $wpGrade_Options->get('homepage_portfolio_title') . '</div></div>

													<div class="border"><span></span></div>

												</a>

											</li>';
                            } elseif ($counter == 2 && $pattern_counter == 4 && $pattern == 'small') {
                                echo '<li class="' . $pattern . ' text more-portfolio" >

												<a href="' . get_portfolio_page_link() . '">

													<div class="title"><div>' . $wpGrade_Options->get('homepage_portfolio_more') . '</div></div>

													<div class="border"><span></span></div>

												</a>

											</li>';
                            } else {
                                //find the best image for this size
                                $image_ID = find_closest_number($portfolio_ratios[$pattern], $attachment_images, "ratio");
                                //delete the image from the array
                                unset($attachment_images[$image_ID]);
                                $image_src = wp_get_attachment_image_src($image_ID, $pattern);
                                echo '<li class="' . $pattern . '" style="background-image:url(' . $image_src[0] . ')">

											<a href="' . get_permalink(get_the_ID()) . '">

												<div class="border"><span></span></div>

											</a>

										</li>';
                            }
                        } else {
                            //put the "Portfolio" box
                            if ($counter == 0 && $pattern == 'long') {
                                echo '<li class="' . $pattern . ' text big-portfolio" >

												<a href="' . get_portfolio_page_link() . '">

													<div class="title"><div>' . __('Portfolio', wpGrade_txtd) . '</div></div>

													<div class="border"><span></span></div>

												</a>

											</li>';
                            } elseif ($counter == 2 && $pattern_counter == 4 && $pattern == 'small') {
                                echo '<li class="' . $pattern . ' text more-portfolio" >

												<a href="' . get_portfolio_page_link() . '">

													<div class="title"><div>' . __('More', wpGrade_txtd) . '</div></div>

													<div class="border"><span></span></div>

												</a>

											</li>';
                            } else {
                                //we output an empty box, just color
                                echo '<li class="' . $pattern . ' empty" ><a href="' . get_post_type_archive_link('portfolio') . '">

													<div class="border"><span></span></div>

												</a></li>';
                            }
                        }
                    } else {
                        if (!empty($featured_image_id)) {
                            $image_src = wp_get_attachment_image_src($featured_image_id, $pattern);
                            echo '<li class="big ' . $video_class . '" style="background-image:url(' . $image_src[0] . ')">

									<a href="' . get_permalink(get_the_ID()) . '">' . $video_markup . '<div class="title"><div><hr>' . get_the_title() . '</div></div>

										<div class="border"><span></span></div>

									</a>

									</li>';
                        } else {
                            if (!empty($video_poster)) {
                                echo '<li class="big ' . $video_class . '" style="background-image:url(' . $video_poster . ')">

									<a href="' . get_permalink(get_the_ID()) . '">' . $video_markup . '<div class="title"><div><hr>' . get_the_title() . '</div></div>

										<div class="border"><span></span></div>

									</a>

									</li>';
                            } else {
                                echo '<li class="' . $pattern . ' empty ' . $video_class . '">

										<a href="' . get_permalink(get_the_ID()) . '">' . $video_markup . '<div class="title"><div><hr>' . get_the_title() . '</div></div>

										<div class="border"><span></span></div>

									</a>

									</li>';
                            }
                        }
                    }
                    $pattern_counter++;
                }
            } else {
                //we don't have any attachments except the featured image
                if (!empty($featured_image_id)) {
                    $image_src = wp_get_attachment_image_src($featured_image_id, 'large');
                    echo '<li class="xbig ' . $video_class . '" style="background-image:url(' . $image_src[0] . ')">

							<a href="' . get_permalink(get_the_ID()) . '">' . $video_markup . '<div class="title"><div><hr>' . get_the_title() . '</div></div>

								<div class="border"><span></span></div>

							</a>

							</li>';
                } else {
                    if (!empty($video_poster)) {
                        echo '<li class="xbig ' . $video_class . '" style="background-image:url(' . $video_poster . ')">

							<a href="' . get_permalink(get_the_ID()) . '">' . $video_markup . '<div class="title"><div><hr>' . get_the_title() . '</div></div>

								<div class="border"><span></span></div>

							</a>

							</li>';
                    } else {
                        echo '<li class="xbig empty ' . $video_class . '">

								<a href="' . get_permalink(get_the_ID()) . '">' . $video_markup . '<div class="title"><div><hr>' . get_the_title() . '</div></div>

								<div class="border"><span></span></div>

							</a>

							</li>';
                    }
                }
            }
            ?>

				  </ul>

				</article>

			<?php 
        }
        $counter++;
    }
    wp_reset_postdata();
    ?>

	</div>

    <?php 
}
Esempio n. 8
0
    /**
     * Display navigation to next/previous pages when applicable
     *
     * @since wpGrade 1.0
     */
    function wpgrade_content_nav($nav_id)
    {
        global $wp_query, $post;
        // Don't print empty markup on single pages if there's nowhere to navigate.
        if (is_single()) {
            $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
            $next = get_adjacent_post(false, '', false);
            if (!$next && !$previous) {
                return;
            }
        }
        // Don't print empty markup in archives if there's only one page.
        if ($wp_query->max_num_pages < 2 && (is_home() || is_archive() || is_search())) {
            return;
        }
        $nav_class = ' paging-navigation';
        if (is_single()) {
            $nav_class = ' post-navigation';
        }
        ?>
	<nav role="navigation" id="<?php 
        echo $nav_id;
        ?>
" class="<?php 
        echo $nav_class;
        ?>
">

	<?php 
        if (is_single()) {
            // navigation links for single posts
            ?>
		<?php 
            next_post_link('%link', '<i class="icon-chevron-left"></i>');
            ?>
		<?php 
            echo '<a href="' . get_portfolio_page_link() . '"><i class="icon-th"></i></a>';
            ?>
		<?php 
            previous_post_link('%link', '<i class="icon-chevron-right"></i>');
            ?>
		

	<?php 
        } elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
            // navigation links for home, archive, and search pages
            ?>

		<?php 
            if (get_next_posts_link()) {
                ?>
		<div class="nav-previous"><?php 
                next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', wpGrade_txtd));
                ?>
</div>
		<?php 
            }
            ?>

		<?php 
            if (get_previous_posts_link()) {
                ?>
		<div class="nav-next"><?php 
                previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', wpGrade_txtd));
                ?>
</div>
		<?php 
            }
            ?>

	<?php 
        }
        ?>

	</nav><!-- #<?php 
        echo $nav_id;
        ?>
 -->
	<?php 
    }