function van_prior_scripts() { global $VAN; wp_register_script('jpreloader', get_template_directory_uri() . '/js/jpreloader.min.js', null, null, false); wp_enqueue_script('jpreloader'); if (is_home()) { if ($VAN['isLoad'] == 1 || !isset($VAN['isLoad'])) { $isLoad = 1; } else { $isLoad = 0; } } else { $isLoad = 0; } if (van_is_mobile()) { $isMobile = 1; } else { $isMobile = 0; } if (isset($VAN['slideTransitionSpeed']) && $VAN['slideTransitionSpeed'] != '') { $slideTransitionSpeed = $VAN['slideTransitionSpeed']; } else { $slideTransitionSpeed = '600'; } if (isset($VAN['slidespeed']) && $VAN['slidespeed'] != '') { $slidePlayingSpeed = $VAN['slidespeed']; } else { $slidePlayingSpeed = '7000'; } if (!isset($VAN['isResponsive']) || $VAN['isResponsive'] == 1) { $isResponsive = '1'; } else { $isResponsive = '0'; } $args = '<script type="text/javascript"> var isLoad=' . $isLoad . '; var isMobile=' . $isMobile . '; var slidePlayingSpeed=' . $slidePlayingSpeed . '; var slideTransitionSpeed=' . $slideTransitionSpeed . '; var isResponsive=' . $isResponsive . '; </script>' . PHP_EOL; echo $args; }
function van_portfolios($category_slug = '', $items = 6, $lightbox = 1, $ajax = 0, $intro = 1, $col = 3, $orderby = 'date', $echo = TRUE) { global $post; $tmp_post = $post; if ($category_slug != '') { $category_array = explode(',', $category_slug); $args = array('numberposts' => $items, 'post_type' => 'portfolio', 'orderby' => 'post_date', 'order' => 'DESC', 'tax_query' => array(array('taxonomy' => 'portfolios', 'field' => 'slug', 'terms' => $category_array, 'include_children' => false))); } else { if ($orderby == 'date') { $args = array('numberposts' => $items, 'post_type' => 'portfolio', 'orderby' => 'post_date', 'order' => 'DESC'); } elseif ($orderby == 'rand') { $args = array('numberposts' => $items, 'post_type' => 'portfolio', 'orderby' => 'rand'); } } $posts = get_posts($args); $return_html = '<div class="portfolios columns' . $col . '">'; foreach ($posts as $post) { setup_postdata($post); if (has_post_thumbnail($post->ID)) { $image_id = get_post_thumbnail_id($post->ID); $image_url = wp_get_attachment_image_src($image_id, 'full', true); if ($col == 3 || $col == '') { $excerpt = van_truncate(strip_tags(do_shortcode($post->post_content)), 180); $thumbnail_url = wp_get_attachment_image_src($image_id, 'portfolio_thumbnail', true); } elseif ($col == 4) { $excerpt = van_truncate(strip_tags(do_shortcode($post->post_content)), 120); $thumbnail_url = wp_get_attachment_image_src($image_id, 'portfolio_thumbnail_4', true); } elseif ($col == 5) { $excerpt = van_truncate(strip_tags(do_shortcode($post->post_content)), 80); $thumbnail_url = wp_get_attachment_image_src($image_id, 'portfolio_thumbnail_5', true); } if (van_is_mobile()) { $thumbnail_url = wp_get_attachment_image_src($image_id, 'portfolio_thumbnail', true); } if ($post->post_excerpt) { $description = $post->post_excerpt; } else { $description = $excerpt; } $portfolio_type = trim(strip_tags(get_post_meta($post->ID, "portfolio_type_value", true))); $portfolio_video = trim(strip_tags(get_post_meta($post->ID, "portfolio_video_value", true))); $portfolio_audio = trim(strip_tags(get_post_meta($post->ID, "portfolio_audio_value", true))); $portfolio_link = trim(strip_tags(get_post_meta($post->ID, "portfolio_link_value", true))); if ($portfolio_type == '') { $portfolio_type = "Image"; } if ($ajax == 0) { if ($lightbox == 1) { switch ($portfolio_type) { case 'Image': $class = " lightbox"; $url = $image_url[0]; $dataUrl = ' data-url=""'; break; case 'Video': $class = ""; $url = get_permalink($post->ID); $dataUrl = ' data-url=""'; break; case 'Audio': $class = ""; $url = get_permalink($post->ID); $dataUrl = ' data-url=""'; break; } } elseif ($lightbox == 0) { $class = ' data-url=""'; $url = get_permalink($post->ID); $dataUrl = ""; } else { $class = ""; $url = get_permalink($post->ID); } } else { $class = " ajax"; $url = 'javascript:void(0)'; $dataUrl = ' data-url="' . get_permalink($post->ID) . '"'; } $target = ''; if ($portfolio_link != '' && isset($portfolio_link)) { $url = $portfolio_link; $target = ' target="_blank"'; $dataUrl = ''; $class = ''; } $terms = get_the_terms($post->ID, 'portfolios'); $slug = array(); if ($terms && !is_wp_error($terms)) { foreach ($terms as $term) { $slug[] = $term->slug; } } $on_slug = join(" ", $slug); $return_html .= '<div class="portfolio-item ' . $on_slug . '" id="portfolio-' . $post->ID . '"' . $dataUrl . '> <a class="overlay' . $class . '" href="' . $url . '" title="' . $post->post_title . '"' . $target . '>'; $return_html .= '<h3>' . $post->post_title . '</h3>'; if ($intro == 1) { $return_html .= '<p class="intro">' . $description . '</p>'; } $return_html .= '</a> <div class="tools">'; $return_html .= '<span' . $dataUrl . '><a href="' . $url . '" class="zoomin' . $class . '" title="' . $post->post_title . '">ZoomIn</a></span>'; if ($portfolio_link != '' && isset($portfolio_link)) { $return_html .= '<a href="' . $url . '" class="info"' . $target . '>Info</a>'; } else { $return_html .= '<a href="' . get_permalink($post->ID) . '" class="info">Info</a>'; } $return_html .= '</div> <a href="' . $url . '" class="item' . $class . '"><img src="' . $thumbnail_url[0] . '" alt="' . $post->post_title . '" /></a>'; $return_html .= '</div>' . PHP_EOL; } } $post = $tmp_post; $return_html .= '<div class="clearfix"></div></div>'; if ($echo) { echo $return_html; } else { return $return_html; } }
<?php while (have_posts()) { the_post(); $portfolio_link = trim(strip_tags(get_post_meta($post->ID, "portfolio_link_value", true))); $layout = ''; if ($col == 4) { $thumbnail = 'portfolio_thumbnail_4'; $limit = 120; } elseif ($col == 5) { $thumbnail = 'portfolio_thumbnail_5'; $limit = 80; } else { $thumbnail = 'portfolio_thumbnail'; $limit = 180; } if (van_is_mobile()) { $thumbnail = 'portfolio_thumbnail'; } if ($portfolio_link == '') { $link = "javascript:void(0);"; $target = "_self"; $ajax = " ajax"; } else { $link = $portfolio_link; $target = "_blank"; $ajax = ""; } $terms = get_the_terms($post->ID, 'portfolios'); $slug = array(); ?> <?php
function van_custom_css() { global $VAN; $custom_css = ''; if (isset($VAN['enable_custom']) && $VAN['enable_custom'] == 1) { //Add Fonts $slider_headtitle_font = explode(':', $VAN['slider_headtitle_font']); $slider_subtitle_font = explode(':', $VAN['slider_subtitle_font']); $section_heading_font = explode(':', $VAN['section_heading_font']); $section_subtitle_font = explode(':', $VAN['section_subtitle_font']); $navi_link_font = explode(':', $VAN['navi_link_font']); if ($VAN['slider_headtitle_font'] != '' && $VAN['slider_headtitle_font'] !== "league_gothic" && $VAN['slider_headtitle_font'] !== "nexa_boldregular" && $VAN['slider_headtitle_font'] !== "nexa_lightregular" && $VAN['slider_headtitle_font'] !== "infinity" && $VAN['slider_headtitle_font'] !== "Oswald") { $custom_css .= '<link href="http://fonts.googleapis.com/css?family=' . str_replace(' ', '+', $slider_headtitle_font[0]) . '&subset=latin,latin-ext" rel="stylesheet" type="text/css">' . PHP_EOL; } if ($VAN['slider_subtitle_font'] != '' && $VAN['slider_subtitle_font'] !== "infinity" && $VAN['slider_subtitle_font'] !== "nexa_boldregular" && $VAN['slider_subtitle_font'] !== "league_gothic" && $VAN['slider_subtitle_font'] !== "nexa_lightregular" && $VAN['slider_subtitle_font'] !== "Oswald") { $custom_css .= '<link href="http://fonts.googleapis.com/css?family=' . str_replace(' ', '+', $slider_subtitle_font[0]) . '&subset=latin,latin-ext" rel="stylesheet" type="text/css">' . PHP_EOL; } if ($VAN['section_heading_font'] != '' && $VAN['section_heading_font'] !== "nexa_boldregular" && $VAN['section_heading_font'] !== "league_gothic" && $VAN['section_heading_font'] !== "nexa_lightregular" && $VAN['section_heading_font'] !== "infinity" && $VAN['section_heading_font'] !== "Oswald") { $custom_css .= '<link href="http://fonts.googleapis.com/css?family=' . str_replace(' ', '+', $section_heading_font[0]) . '&subset=latin,latin-ext" rel="stylesheet" type="text/css">' . PHP_EOL; } if ($VAN['section_subtitle_font'] != '' && $VAN['section_subtitle_font'] !== "nexa_lightregular" && $VAN['section_subtitle_font'] !== "nexa_boldregular" && $VAN['section_subtitle_font'] !== "league_gothic" && $VAN['section_subtitle_font'] !== "infinity" && $VAN['section_subtitle_font'] !== "Oswald") { $custom_css .= '<link href="http://fonts.googleapis.com/css?family=' . str_replace(' ', '+', $section_subtitle_font[0]) . '&subset=latin,latin-ext" rel="stylesheet" type="text/css">' . PHP_EOL; } if ($VAN['navi_link_font'] != '' && $VAN['navi_link_font'] !== "nexa_boldregular" && $VAN['navi_link_font'] !== "league_gothic" && $VAN['navi_link_font'] !== "nexa_lightregular" && $VAN['navi_link_font'] !== "infinity" && $VAN['navi_link_font'] !== "Oswald") { $custom_css .= '<link href="http://fonts.googleapis.com/css?family=' . str_replace(' ', '+', $navi_link_font[0]) . '&subset=latin,latin-ext" rel="stylesheet" type="text/css">' . PHP_EOL; } } $custom_css .= '<style type="text/css">' . PHP_EOL; if (isset($VAN['isLoad']) && $VAN['isLoad'] == 0) { $custom_css .= 'body.home{display:block;}' . PHP_EOL; } if (isset($VAN['logo']) && $VAN['logo'] != '') { $custom_css .= 'h1#site-logo a{background:url(' . $VAN['logo'] . ') no-repeat;}' . PHP_EOL; } if (isset($VAN['high_logo']) && $VAN['high_logo'] != '') { $custom_css .= '@media only screen and (-Webkit-min-device-pixel-ratio: 1.5), only screen and (-moz-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (min-device-pixel-ratio: 1.5) { h1#site-logo a { background-image: url(' . $VAN['high_logo'] . '); background-size: auto 69px; } }' . PHP_EOL; } if (isset($VAN['enable_custom']) && $VAN['enable_custom'] == 1) { //Custom CSS if (isset($VAN['global_link']) && $VAN['global_link'] != '') { $custom_css .= 'a{color:' . $VAN['global_link'] . ';}' . PHP_EOL; } if (isset($VAN['global_link_hover']) && $VAN['global_link_hover'] != '') { $custom_css .= 'a:hover{color:' . $VAN['global_link_hover'] . ';}' . PHP_EOL; } if (isset($VAN['selection_color']) && $VAN['selection_color'] != '') { $custom_css .= '::selection{background:' . $VAN['selection_color'] . ';}' . PHP_EOL; } if (isset($VAN['navi_bg']) && $VAN['navi_bg'] != '') { $custom_css .= '#primary-menu,#primary-menu-container li ul.sub-menu{background:' . $VAN['navi_bg'] . ';}' . PHP_EOL; } if (isset($VAN['navi_link_font']) && $VAN['navi_link_font'] != '') { $custom_css .= '#primary-menu-container a{font-family:"' . str_replace('+', ' ', $navi_link_font[0]) . '",Arial;}' . PHP_EOL; } if (isset($VAN['navi_link_size']) && $VAN['navi_link_size'] != '') { $custom_css .= '#primary-menu-container a{font-size:' . $VAN['navi_link_size'] . 'px;}' . PHP_EOL; } if (isset($VAN['navi_link']) && $VAN['navi_link'] != '') { $custom_css .= '#primary-menu-container a,#primary-menu-container li ul.sub-menu li a{color:' . $VAN['navi_link'] . ';}' . PHP_EOL; } if (isset($VAN['navi_link_hover']) && $VAN['navi_link_hover'] != '') { $custom_css .= '#primary-menu-container a:hover,#primary-menu-container li.current-menu-item a:hover,#primary-menu-container li ul.sub-menu li a:hover{color:' . $VAN['navi_link_hover'] . ';}' . PHP_EOL; } if (isset($VAN['navi_link_bghover']) && $VAN['navi_link_bghover'] != '') { $custom_css .= '.sf-menu li:hover, .sf-menu li.sfHover, .sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {background:' . $VAN['navi_link_bghover'] . ';}' . PHP_EOL; } if (isset($VAN['navi_link_active']) && $VAN['navi_link_active'] != '') { $custom_css .= '#primary-menu-container ul li.current-menu-item a{color:' . $VAN['navi_link_active'] . ';}' . PHP_EOL; } if (isset($VAN['footer_bg_color']) && $VAN['footer_bg_color'] != '' || isset($VAN['footer_text_color']) && $VAN['footer_text_color'] != '') { $custom_css .= '#footer{background:' . $VAN['footer_bg_color'] . ';color:' . $VAN['footer_text_color'] . ';}' . PHP_EOL; } if (isset($VAN['footer_link']) && $VAN['footer_link'] != '') { $custom_css .= '#footer a{color:' . $VAN['footer_link'] . ';}' . PHP_EOL; } if (isset($VAN['footer_link_hover']) && $VAN['footer_link_hover'] != '') { $custom_css .= '#footer a:hover{color:' . $VAN['footer_link_hover'] . ';}' . PHP_EOL; } if (isset($VAN['slider_headtitle_font']) && $VAN['slider_headtitle_font'] != '') { $custom_css .= '#featured .oneColumn #firstTitle,#featured .twoColumns #firstTitle{font-family:"' . str_replace('+', ' ', $slider_headtitle_font[0]) . '",Arial;}' . PHP_EOL; } if (isset($VAN['slider_subtitle_font']) && $VAN['slider_subtitle_font'] != '') { $custom_css .= '#featured .oneColumn #secondTitle,#featured .twoColumns #secondTitle{font-family:"' . str_replace('+', ' ', $slider_subtitle_font[0]) . '",Arial;}' . PHP_EOL; } if (isset($VAN['slider_headtitle_bigsize']) && $VAN['slider_headtitle_bigsize'] != '') { $custom_css .= '#featured .oneColumn #firstTitle{font-size:' . $VAN['slider_headtitle_bigsize'] . 'px;}' . PHP_EOL; } if (isset($VAN['slider_headtitle_smallsize']) && $VAN['slider_headtitle_smallsize'] != '') { $custom_css .= '#featured .twoColumns #firstTitle{font-size:' . $VAN['slider_headtitle_smallsize'] . 'px;}' . PHP_EOL; } if (isset($VAN['slider_subtitle_bigsize']) && $VAN['slider_subtitle_bigsize'] != '') { $custom_css .= '#featured .oneColumn #secondTitle{font-size:' . $VAN['slider_subtitle_bigsize'] . 'px;}' . PHP_EOL; } if (isset($VAN['slider_subtitle_smallsize']) && $VAN['slider_subtitle_smallsize'] != '') { $custom_css .= '#featured .twoColumns #secondTitle{font-size:' . $VAN['slider_subtitle_smallsize'] . 'px;}' . PHP_EOL; } if (isset($VAN['section_heading_font']) && $VAN['section_heading_font'] != '') { $custom_css .= '.page-area hgroup.title h1,.page-area hgroup.title h1 strong{font-family:"' . str_replace('+', ' ', $section_heading_font[0]) . '",Arial;}' . PHP_EOL; } if (isset($VAN['section_subtitle_font']) && $VAN['section_subtitle_font'] != '') { $custom_css .= '.page-area hgroup.title p{font-family:"' . str_replace('+', ' ', $section_subtitle_font[0]) . '",Arial;}' . PHP_EOL; } if (isset($VAN['section_heading_size']) && $VAN['section_heading_size'] != '') { $custom_css .= '.page-area hgroup.title h1,.page-area hgroup.title h1 strong{font-size:' . $VAN['section_heading_size'] . 'px;font-weight:normal;}' . PHP_EOL; } if (isset($VAN['section_subtitle_size']) && $VAN['section_subtitle_size'] != '') { $custom_css .= '.page-area hgroup.title p{font-size:' . $VAN['section_subtitle_size'] . 'px;}' . PHP_EOL; } if (isset($VAN['contact_background']) && $VAN['contact_background'] != '') { $custom_css .= '#contact{background:url(' . $VAN['contact_background'] . ') repeat center fixed;background-size:cover;}' . PHP_EOL; } if (isset($VAN['contact_background_color']) && $VAN['contact_background_color'] != '') { $custom_css .= '#contact{background-color:' . $VAN['contact_background_color'] . ';}' . PHP_EOL; } if (isset($VAN['contact_text_color']) && $VAN['contact_text_color'] != '') { $custom_css .= '#contact,#contact .title h1 strong,#contact .title p,.contactway{color:' . $VAN['contact_text_color'] . ';}' . PHP_EOL; $custom_css .= '#contact .contactway{border-color:' . $VAN['contact_text_color'] . ';filter:alpha(Opacity=80);-moz-opacity:0.8;opacity: 0.8;}'; } if (isset($VAN['contact_input_background']) && $VAN['contact_input_background'] != '') { $custom_css .= '.contactform input,.contactform textarea{background:' . $VAN['contact_input_background'] . ';}' . PHP_EOL; } if (isset($VAN['contact_input_text']) && $VAN['contact_input_text'] != '') { $custom_css .= '.contactform input,.contactform textarea{color:' . $VAN['contact_input_text'] . ';}' . PHP_EOL; $custom_css .= '#contactName::-moz-placeholder {color:' . $VAN['contact_input_text'] . ';} ::-webkit-input-placeholder {color:' . $VAN['contact_input_text'] . ';}' . PHP_EOL; } if (isset($VAN['contact_btn_background']) && $VAN['contact_btn_background'] != '') { $custom_css .= '.contactform .contact-btn{background:' . $VAN['contact_btn_background'] . ';}' . PHP_EOL; } if (isset($VAN['contact_btn_text']) && $VAN['contact_btn_text'] != '') { $custom_css .= '#contact .contactform .contact-btn{color:' . $VAN['contact_btn_text'] . ';text-shadow:none;}' . PHP_EOL; } } if (van_is_mobile() && !is_home()) { $custom_css .= '.portfolio-item{display:none;}'; } if (!isset($VAN['isResponsive']) || $VAN['isResponsive'] == 1) { if (isset($VAN['show_mobile_logo']) && $VAN['show_mobile_logo'] == 1) { $custom_css .= '@media only screen and (max-width: 640px) { h1#site-logo, h1#site-logo a{width:60%;height:60px;background-size:100%;background-position:center;} :root .css3-selectbox{ display:inline-block; width:40%; float:right; } }' . PHP_EOL; } else { $custom_css .= '@media only screen and (max-width: 640px) { :root .css3-selectbox{width:100%;display:inline-block;} h1#site-logo{display:none;} }' . PHP_EOL; } } $count_slides = wp_count_posts('slider'); $published_slides = $count_slides->publish; if ($published_slides > 1) { $custom_css .= '#featured .slide_content{margin-top:280px;}' . PHP_EOL; $custom_css .= '@-moz-document url-prefix(){#featured .slide_bg{margin-top:0px;}}' . PHP_EOL; } else { $custom_css .= '#featured .slide_bg{margin-top:420px;}' . PHP_EOL; if (!isset($VAN['isResponsive']) || $VAN['isResponsive'] == 1) { $custom_css .= '@media only screen and (max-width: 640px) { #featured .slide_bg{margin-top:0px;} #featured .slide_content{top:0px;} }' . PHP_EOL; } } $custom_css .= '</style>' . PHP_EOL; $custom_css .= '<link href="' . get_template_directory_uri() . '/custom.css" type="text/css" rel="stylesheet" />' . PHP_EOL; if (!isset($VAN['isResponsive']) || $VAN['isResponsive'] == 1) { $custom_css .= '<link href="' . get_template_directory_uri() . '/css/media-queries.css" type="text/css" rel="stylesheet" />' . PHP_EOL; } $custom_css .= '<link href="http://fonts.googleapis.com/css?family=Oswald:400,700,300&subset=latin,latin-ext" type="text/css" rel="stylesheet" />' . PHP_EOL; echo $custom_css; }