public function run($config = array()) { wp_enqueue_script('flexSliderScript'); wp_enqueue_style('flexSlider'); $this->run = true; global $post; $cat_id = YSettings::g('slider_cat', ''); $query = array('cat' => $cat_id); $queryObject = new WP_Query($query); $postCount = 0; $maxCount = YSettings::g('slider_post_count', 5); $postsData = array(); if ($queryObject->have_posts()) { while ($queryObject->have_posts()) { $queryObject->the_post(); if (!has_post_thumbnail()) { continue; } if ($postCount >= $maxCount) { break; } $postCount++; $words = explode(' ', get_the_title()); $firstline = ''; $secondline = ''; foreach ($words as $nextWord) { if (strlen($firstline) + strlen($nextWord) < 24) { $firstline .= ' ' . array_shift($words); } } foreach ($words as $word) { $secondline .= ' ' . $word; } $excerpt = get_the_excerpt(); $exc = mb_substr($excerpt, 0, 190); if (strlen($excerpt) > 190) { $exc .= ' ...'; } $imageSize = isset($config['imageSize']) ? $config['imageSize'] : 'original'; $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id(), $imageSize); $postsData[] = array('permalink' => get_permalink(), 'firstline' => $firstline, 'secondline' => $secondline, 'img_src' => $imgsrc[0], 'the_excerpt' => $exc); } } if (count($postsData) > 0) { YoPressBase::instance()->webView->renderPath('/components/flexslider/views/index', array('postsData' => $postsData)); } else { get_template_part('content', 'slider-empty'); } wp_reset_postdata(); }
function trimExcerpt($content) { global $excerptLength; $excerptLength = YSettings::g('theme_post_excerpt_length', 160); // if($excerptLength == '' || $excerptLength == 0) { // $excerptLength = 160; // } if (strlen($content) > $excerptLength) { $excerpt = explode(' ', $content); $returnString = ''; foreach ($excerpt as $word) { $returnString .= ' ' . $word; if (strlen($returnString) > $excerptLength) { break; } } $returnString .= ' ...'; return $returnString; } else { return $content; } }
</div> </div> </div> </article> <div class="container"> <div class="row"> <div class="post-text <?php echo $class; ?> "> <article> <?php the_content(); ?> <?php if (YSettings::g('posts_show_tag', 1) == 1) { ?> <div class="berg-tags"><?php the_tags(); ?> </div> <?php } ?> </article> </div> <?php if (is_active_sidebar('posts')) { ?> <div class="col-xs-12 col-md-4 widget-sidebar <?php echo $sidebar;
function drawMap() { ?> <script type="text/javascript"> var centerPositionLat = <?php echo YSettings::g('contact_map_center_lat', 0); ?> ; var centerPositionLng = <?php echo YSettings::g('contact_map_center_lng', 0); ?> ; var markerPositionLat = <?php echo YSettings::g('contact_map_marker_lat', 0); ?> ; var markerPositionLng = <?php echo YSettings::g('contact_map_marker_lng', 0); ?> ; var zoomLevel = <?php echo YSettings::g('contact_map_zoom_level', 1); ?> ; var markerImage = '<?php echo YSettings::g('contact_map_marker_image', ''); ?> '; var mapType = '<?php echo YSettings::g('contact_map_type', 'roadmap'); ?> '; </script> <tr class="form-field"> <th scope="row"> <label for="map_canvas"><?php echo __('Choose location', THEME_NAME); ?> </label> </th> <td><div style="width:400px;height:300px;" id="map_canvas"></div></td> </tr> <tr class="form-field"> <th scope="row"> <label for="contact_map_address_id"><?php echo __('Address', THEME_NAME); ?> </label> </th> <td><input style="width:320px;" type="text" id="contact_map_address_id" name="yopress[contact_map_address]" value="<?php YSettings::g("contact_map_address"); ?> "> <button id="contact_map_search" class="button"><?php echo __('Search', THEME_NAME); ?> </button></td> </tr> <?php }
echo $image; ?> " alt=""/> <div class="actions"> <i class="icon-magnifier-add"></i> </div> </figure> </a> <?php } ?> <div class="post-content"> <?php if (YSettings::g('blog_show_date', 1) == 1) { ?> <span class="date"> <?php berg_wp_posted_on(); ?> </span> <?php } ?> <?php the_title(sprintf('<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h3>'); ?> <?php echo get_post_details('', 'blog');
?> </div> </nav> <div id="mobile-nav" class="visible-xs visible-sm mobile-nav"> <header> <div class="container-fluid"> <ul class="menu-header"> <li class="pull-left"> <a href="<?php echo home_url(); ?> " class="logo"> <figure> <img src="<?php echo YSettings::g('logo_image_dark', THEME_DIR_URI . '/img/logo2.png'); ?> " alt="<?php echo THEME_NAME; ?> "/> </figure> </a> </li> <li class="reorder pull-right"><a href="#" title=""><i class="fa fa-bars"></i></a></li> </ul> </div> </header> <?php if (has_nav_menu('mobile')) { wp_nav_menu(array('theme_location' => 'mobile', 'depth' => 2, 'container_class' => 'flyout-container', 'walker' => new Child_Wrapper()));
?> href="<?php echo esc_url(YSettings::g('theme_' . $social)); ?> "><i class="socicon"><?php echo $barnelli_mobileIcons[$social]; ?> </i></a> <?php } else { ?> <a <?php echo $window; ?> href="<?php echo esc_url(YSettings::g('theme_' . $social)); ?> "><i class="monosymbol"><?php echo $barnelli_mobileIcons[$social]; ?> </i></a> <?php } ?> </li> <?php } } ?> </ul> </div>
function get_post_details($class = '', $type = 'posts') { $comments_in_author = YSettings::g($type . '_show_author', 1) == 1 && YSettings::g($type . '_show_cat', 1) == 1; $content = '<ul class="post_details ' . $class . '">'; if (is_sticky() && is_home() && !is_paged()) { $content .= '<li><span class="highlight highlight-color"><i class="icon-pin"></i> <strong>' . __('Sticky', THEME_NAME) . '</strong></span></li>'; } if (YSettings::g($type . '_show_author', 1) == 1) { $content .= '<li><span>' . __('by', THEME_NAME) . '</span> <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author() . '</a> '; if ($comments_in_author) { $categories = ''; foreach (get_the_category() as $category) { $categories .= '<li><a href="' . esc_url(get_category_link($category->term_id)) . '" title="' . $category->name . '">' . $category->name . '</a></li>'; } $content .= '<span>' . __('in', THEME_NAME) . '</span> <ul>' . $categories . '</ul>'; } $content .= '</li>'; } if (!$comments_in_author) { if (YSettings::g($type . '_show_cat', 1) == 1) { $categories = ''; foreach (get_the_category() as $category) { $categories .= '<li><a href="' . esc_url(get_category_link($category->term_id)) . '" title="' . $category->name . '">' . $category->name . '</a></li>'; } $content .= '<li><ul>' . $categories . '</ul></li>'; } } if (YSettings::g($type . '_show_comments', 1) == 1) { $content .= '<li><a href="' . esc_url(get_comments_link()) . '" title="">' . get_comments_number_text() . '</a></li>'; } $content .= '</ul>'; return $content; }
} } ?> </ul> <?php } ?> <header class="section-header"> <h2><?php the_title(); ?> </h2> </header> <?php $images = YSettings::g('berg_images_per_page', 9); if (is_array($categories)) { $the_query = new WP_Query(array('post_type' => 'berg_portfolio', 'posts_per_page' => $images, 'orderby' => 'date ID', 'paged' => 1, 'tax_query' => array(array('taxonomy' => 'berg_portfolio_categories', 'terms' => $categories)))); ?> <div class="gallery-content three-columns" data-columns="3" data-pages="<?php echo $the_query->max_num_pages; ?> "> <?php if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); get_template_part('portfolio', 'single'); } } else {
')" target="_blank" title=""><i class="fa fa-google-plus"></i></a> </li> <?php } ?> <?php if (YSettings::g('share_on_pinterest', '1') == '1') { ?> <li> <a href="javascript:shareThis('http://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?> ')" target="_blank" title=""><i class="fa fa-pinterest"></i></a> </li> <?php } ?> <?php if (YSettings::g('share_on_linkedin', '1') == '1') { ?> <li> <a href="javascript:shareThis('http://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink(); ?> ')" target="_blank" title=""><i class="fa fa-linkedin"></i></a> </li> <?php } ?> </ul> </div>
$dataOpacityEnd = 100; if (isset($post_meta['intro_opacity'][0])) { $section_intro_opacity = $post_meta['intro_opacity'][0]; if ($section_intro_opacity != 'default') { $dataOpacityStart = $section_intro_opacity; } else { $dataOpacityStart = YSettings::g('berg_intro_opacity_start', 30); } } $section_intro_opacity_end = 0; if (isset($post_meta['intro_opacity_end'][0])) { $section_intro_opacity_end = $post_meta['intro_opacity_end'][0]; if ($section_intro_opacity_end != 'default') { $dataOpacityEnd = $section_intro_opacity_end; } else { $dataOpacityEnd = YSettings::g('berg_intro_opacity_end', 100); } } $contact = false; if ($post_meta['_wp_page_template'][0] == 'contact.php') { $contact = true; } if ($img_url == '') { $img_url = 'http://placehold.it/1440x900&text=Please+select+featured+image'; } ?> <div class="intro-wrapper"> <div class="section-intro section-intro-half" data-opacity-start="<?php echo $dataOpacityStart; ?> " data-opacity-end="<?php
<?php $post_meta = get_post_meta(get_the_ID()); if (isset($post_meta['social_share_menu'][0])) { $social_sharer = $post_meta['social_share_menu'][0]; if ($social_sharer != 'default') { if ($social_sharer == 'enabled') { get_template_part('social', 'share'); } } else { if (YSettings::g('berg_sharer_menu', 1) == 1) { get_template_part('social', 'share'); } } } else { if (YSettings::g('berg_sharer_menu', 1) == 1) { get_template_part('social', 'share'); } } ?> <?php //get_template_part('social', 'share'); ?> </div> </div> <div class="product-description row"> <div class="description col-md-8 col-md-offset-2"> <?php the_content(); ?> </div>
</div> <div id="preloader"> <div id="status"> <div class="loading-wrapper"> <img src="<?php echo YSettings::g('loading_image', THEME_DIR_URI . '/img/logo2.png'); ?> " alt="Loading"/> </div> </div> <div id="status-loaded"></div> </div> <?php if (YSettings::g('theme_google_analytics')) { echo YSettings::g('theme_google_analytics'); } ?> <script type="text/javascript"> var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?> '; var pageId = '<?php echo get_the_id(); ?> '; </script> <?php wp_footer(); ?>
<div class="bg-section map" id="map"></div> <?php $tmp = YSettings::g('multiple_contact_locations', '1'); $locations = explode("|", $tmp); $mapLocations = array(); foreach ($locations as $key => $value) { $image = YSettings::g("multiple_contact_map_marker_image_" . $value); $mapLocations[] = array('uuid' => $value, 'lat' => YSettings::g("multiple_contact_map_lat_" . $value, 50.84556), 'lng' => YSettings::g("multiple_contact_map_lng_" . $value, 16.480884), 'marker' => $image == '' ? false : $image, 'markerHeight' => YSettings::g("multiple_contact_marker_height_" . $value, 0), 'markerWidth' => YSettings::g("multiple_contact_marker_width_" . $value, 0), 'header' => YSettings::g("multiple_contact_address_header_" . $value), 'address' => YSettings::g("multiple_contact_address_" . $value)); } ?> <script> var mapLocations = <?php echo json_encode(array('locations' => $mapLocations)); ?> ; function initializeMap() { var options = { mapTypeId: 'roadmap' }; var map = new google.maps.Map($('#map')[0], options); var latLngBounds = new google.maps.LatLngBounds(); jQuery.each( mapLocations.locations, function( key, value ) { var markerImage = value.marker; var latLng = new google.maps.LatLng(value.lat, value.lng); latLngBounds.extend(latLng); var options = { position: latLng, title: value.header, map: map,
} else { ?> <div class="visible-xs mobile-homepage" style="position: relative; background-image: url(http://placehold.it/1440x900); background-size: cover; background-position: center center; "> <div class="container-fluid homepage" style="position: static; "> <div class="mobile-overlay" style="position: absolute; height: 100%; width: 100%; left: 0; top: 0; background: #000; opacity: 0.3;"></div> <div class="basic-info text-center"> <h2><?php echo __('Please select mobile homepage in YoPress settings', THEME_NAME); ?> </h2> </div> </div> </div> <?php } ?> <?php if (YSettings::g('mobile_homepage', 0) != 0) { if (get_post_meta($pageMobile->ID, 'mobile_home_footer', 1) == 0) { ?> <script> jQuery(document).ready(function(){ $('#footer').addClass('hidden-xs'); }) </script> <?php } } berg_getFooter(); get_template_part('footer');
while (have_posts()) { the_post(); ?> <?php $post_meta = get_post_meta(get_the_ID()); if (isset($post_meta['post_template'][0])) { $post_template = $post_meta['post_template'][0]; if ($post_template != 'default') { if ($post_template == 'post_template_2') { get_template_part('content', 'single2'); } else { get_template_part('content', 'single'); } } else { if (YSettings::g('berg_post_template', 1) == 1) { get_template_part('content', 'single'); } else { get_template_part('content', 'single2'); } } } else { get_template_part('content', 'single'); } if (comments_open() || '0' != get_comments_number()) { comments_template(); } ?> <?php }
<?php if (YSettings::g('berg_archive_template', 1) == 1) { get_template_part('archive', 'content2'); } else { get_template_part('archive', 'content'); } if (YSettings::g('berg_archive_footer', 1) == 1) { get_template_part('footer', 'content'); } get_template_part('footer'); ?> </body> </html>
?> <section id="blog" class="section-scroll main-section blog-content blog"> <header class="section-header"> <h2><?php echo the_title(); ?> </h2> </header> <div class="container-fluid"> <?php if ($categories == '') { $the_query = new WP_Query(array('posts_per_page' => YSettings::g('blog_post_per_page', 2))); } else { $the_query = new WP_Query(array('posts_per_page' => YSettings::g('blog_post_per_page', 2), 'tax_query' => array(array('taxonomy' => 'category', 'terms' => $categories)))); } ?> <div id="blog-content-append" class="row" data-pages="<?php echo $the_query->max_num_pages; ?> "> <?php if ($the_query->have_posts()) { ?> <?php /* Start the Loop */ ?> <?php while ($the_query->have_posts()) {
; var markerPositionLat = <?php echo YSettings::g('contact_map_marker_lat', 0); ?> ; var markerPositionLng = <?php echo YSettings::g('contact_map_marker_lng', 0); ?> ; var zoomLevel = <?php echo YSettings::g('contact_map_zoom_level', 1); ?> ; var markerImage = '<?php echo YSettings::g("contact_map_marker_image", ''); ?> '; var mapType = '<?php echo YSettings::g('contact_map_type', 'roadmap'); ?> '; </script> <script type="text/javascript" src="../admin/admin.js"></script> </div> </div> </div> </div> </div> </div> </body> </html>
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { global $wp_query; $indent = $depth ? str_repeat("\t", $depth) : ''; $class_names = $value = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item)); $slideUrl = rtrim($item->url, '/'); $homeUrl = rtrim(get_home_url(), '/'); $custom_icon = get_post_meta($item->ID, '_menu_item_custom_icon', true); if ($custom_icon == '') { $custom_icon = 'fa fa-circle'; } $showIcon = true; if ($custom_icon == 'no-icon') { $showIcon = false; } $custom_icon_image = get_post_meta($item->ID, '_menu_item_custom_icon_image', true); if ($custom_icon_image != '') { $bgImg = $custom_icon_image; $image = explode('.', $custom_icon_image); $image[count($image) - 2] = $image[count($image) - 2] . '-40x40'; $custom_icon_image = implode('.', $image); $tmp = explode('/wp-content/uploads/', $custom_icon_image); $wpUploadDir = wp_upload_dir(); $imagePath = $wpUploadDir['basedir'] . '/' . $tmp[1]; if (!file_exists($imagePath)) { $custom_icon_image = $bgImg; } } if ($custom_icon == 'no-icon') { if (strstr($class_names, 'current-menu-item')) { $class_names = ' no-icon-active ' . $class_names; } $class_names = ' no-icon ' . $class_names; } if ($item->attr_title == 'logo') { $class_names = ' class="menu-slide menu-image ' . esc_attr($class_names) . '"'; } else { if ($item->attr_title == 'slider') { $class_names = ' class="menu-slide ' . esc_attr($class_names) . '"'; } else { $class_names = ' class="' . esc_attr($class_names) . '"'; } } $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : ''; $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : ''; $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : ''; $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : ''; $item_output = $args->before; if ($item->attr_title == 'logo') { $logoImage = YSettings::g('logo_image', 'http://placehold.it/309x120'); if ($depth == 0) { $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '><div>'; } else { $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>'; } $item_output .= '<a class="content-link" ' . $attributes . '>'; $item_output .= '<img src="' . $logoImage . '" alt="" />'; $item_output .= '</a>'; if ($depth == 0) { $item_output .= $args->after; } $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); } else { if ($depth == 0) { $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '><div>'; } else { $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>'; } $hoverColor = YSettings::g('nav_menu_font_color_hover', '#666666'); if ($custom_icon == 'no-icon') { //$span = '<span style="opacity:1;color:'.$hoverColor.' !important;">'; $span = '<span>'; } else { $span = '<span>'; } if ($depth == 0) { if ($item->attr_title == 'link') { $item_output .= '<a data-djax-exclude="true" class="content-link ' . str_replace(" ", "-", $item->title) . '-wrapper"' . $attributes . '>' . $span; } else { $item_output .= '<a class="content-link ' . str_replace(" ", "-", $item->title) . '-wrapper"' . $attributes . '>' . $span; } } else { if ($item->attr_title == 'link') { $item_output .= '<a data-djax-exclude="true" ' . $attributes . '>' . $span; } else { $item_output .= '<a ' . $attributes . '>' . $span; } } $menu_icon = ''; if ($custom_icon_image != '') { $menu_icon = '<img src="' . $custom_icon_image . '" alt="" />'; } else { $menu_icon = $custom_icon == 'no-icon' ? '' : '<i style="color:' . $hoverColor . ' !important;" class="' . $custom_icon . '"></i>'; } $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; if (strlen($item->description) > 2) { $item_output .= '<br /><span class="sub">' . $item->description . '</span>'; } if ($depth == 0) { $item_output .= '</span>' . $menu_icon . '</a>'; } else { $item_output .= '</span></a>'; } if ($depth == 0) { $item_output .= $args->after; } $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); } }