/** * Get the post id to use to display a header * For example, if a header is set for the blog, we will use it for the archive and search page * * @return int $id */ function wolf_get_header_post_id() { if (is_404() || is_page_template('page-templates/home.php')) { return; } $post_id = null; $shop_page_id = wolf_get_woocommerce_shop_page_id(); $is_shop_page = function_exists('is_shop') ? is_shop() : false; $is_product_taxonomy = function_exists('is_product_taxonomy') ? is_product_taxonomy() : false; $is_single_product = function_exists('is_product') ? is_product() : false; // is blog if (get_option('page_for_posts') && wolf_is_blog() && false == $is_shop_page && false == $is_product_taxonomy) { $post_id = get_option('page_for_posts'); // if woocommerce } elseif ($is_shop_page || $is_product_taxonomy) { $post_id = $shop_page_id; // is single product } elseif ($is_single_product) { if (get_post_meta(get_the_ID(), '_header_bg_img', true) || get_post_meta(get_the_ID(), '_header_bg_color', true)) { $post_id = get_the_ID(); } else { $post_id = $shop_page_id; } } else { $post_id = get_the_ID(); } return $post_id; }
?> id="post-<?php the_ID(); ?> " data-post-id="<?php the_ID(); ?> " data-bg="<?php echo esc_url($bg); ?> "> <div class="entry-frame entry-content"> <div class="entry-container"> <header class="entry-header"> <?php if ('gallery' == $format && !wolf_is_blog()) { ?> <?php echo wolf_post_gallery_slider('classic-thumb'); ?> <?php } else { ?> <?php $media = wolf_post_media(true, 'masonry'); if ($media && !post_password_required()) { ?> <div class="post-media-container" class="clearfix"> <?php echo wolf_post_media(true, 'masonry'); ?>
function wolf_custom_gallery($output, $attr) { global $post, $wp_locale; static $instance = 0; $instance++; // We're trusting author input, so let's at least make sure it looks like a valid orderby statement if (isset($attr['orderby'])) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if (!$attr['orderby']) { unset($attr['orderby']); } } extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => ''), $attr)); $id = intval($id); if ('RAND' == $order) { $orderby = 'none'; } if (!empty($include)) { $include = preg_replace('/[^0-9,]+/', '', $include); $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } elseif (!empty($exclude)) { $exclude = preg_replace('/[^0-9,]+/', '', $exclude); $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } if (empty($attachments)) { return ''; } if (is_feed()) { $output = "\n"; foreach ($attachments as $att_id => $attachment) { $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; } return $output; } $itemtag = tag_escape($itemtag); $captiontag = tag_escape($captiontag); $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100 / $columns) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instance}"; $output = apply_filters('gallery_style', "\r\n\t\t\t<style type='text/css'>\r\n\t\t\t\t#{$selector} {\r\n\t\t\t\t\tmargin: auto;\r\n\t\t\t\t}\r\n\t\t\t\t#{$selector} .gallery-item {\r\n\t\t\t\t\tfloat: {$float};\r\n\t\t\t\t\tmargin-top: 10px;\r\n\t\t\t\t\ttext-align: center;\r\n\t\t\t\t\twidth: {$itemwidth}%;\r\n\t\t\t\t}\r\n\t\t\t\t#{$selector} img {\r\n\t\t\t\t\tborder: 2px solid #cfcfcf;\r\n\t\t\t\t}\r\n\t\t\t\t#{$selector} .gallery-caption {\r\n\t\t\t\t\tmargin-left: 0;\r\n\t\t\t\t}\r\n\t\t\t</style>\r\n\t\t\t<!-- see gallery_shortcode() in wp-includes/media.php -->\r\n\t\t\t<div id='{$selector}' class='gallery galleryid-{$id}'>"); $i = 0; foreach ($attachments as $id => $attachment) { $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false); $output .= "<{$itemtag} class='gallery-item'>"; $output .= "\r\n\t\t\t<{$icontag} class='gallery-icon'>\r\n\t\t\t{$link}\r\n\t\t\t</{$icontag}>"; if ($captiontag && trim($attachment->post_excerpt)) { $output .= "\r\n\t\t\t\t<{$captiontag} class='gallery-caption'>\r\n\t\t\t\t" . wptexturize($attachment->post_excerpt) . "\r\n\t\t\t\t</{$captiontag}>"; } $output .= "</{$itemtag}>"; if ($columns > 0 && ++$i % $columns == 0) { $output .= '<br style="clear: both" />'; } } $output .= "\r\n\t\t<br style='clear: both;' />\r\n\t\t</div>\n"; /* Slider output */ $slider_output = '<div class="wolf-wp-gallery-slider flexslider"><ul class="slides">'; foreach ($attachments as $id => $attachment) { $src = wolf_get_url_from_attachment_id($id, '2x1'); $slider_output .= ''; $slider_output .= '<li class="slide">'; $slider_output .= "<img src='{$src}' alt=''>"; $slider_output .= '</li>'; } $slider_output .= '</ul></div>'; /* Masonry gallery output */ $masonry_output = '<div class="clearfix gallery masonry-gallery"><ul>'; foreach ($attachments as $id => $attachment) { $src = wolf_get_url_from_attachment_id($id, 'masonry'); $full_src = wolf_get_url_from_attachment_id($id, 'extra-large'); $masonry_output .= '<li>'; $masonry_output .= "<a class='lightbox' href='{$full_src}'>"; $masonry_output .= "<img src='{$src}' alt='gallery-image'>"; $masonry_output .= '</a>'; $masonry_output .= '</li>'; } $masonry_output .= '</ul></div>'; if (wolf_is_blog() || wolf_is_portfolio()) { return $slider_output; } elseif (is_singular('gallery')) { return $masonry_output; } else { return $output; } }
/** * If I we any sticky posts, the query will display more than the 12 posts we have specified in the function above * * We will fix this with a pre_get_posts hook * * @see http://wordpress.stackexchange.com/questions/76620/sticky-posts-exceed-posts-per-page-limit * @access public * @return void */ function wolf_fix_posts_per_page_with_sticky_posts($query) { if ($query->is_main_query() && 'grid' == wolf_get_theme_option('blog_type') && wolf_is_blog()) { // set the number of posts per page $posts_per_page = 12; // get sticky posts array $sticky_posts = get_option('sticky_posts'); // get queried post ids array $ids = array(); $args = array('post_type' => 'post', 'post_per_page' => $posts_per_page, 'paged' => 1); $posts = get_posts($args); foreach ($posts as $post) { $ids[] = $post->ID; } // if we have any sticky posts and we are at the first page if (is_array($sticky_posts) && !$query->is_paged()) { // count the number of sticky posts $sticky_count = count($sticky_posts); foreach ($sticky_posts as $sticky_post) { if (in_array($sticky_post, $ids)) { $sticky_count--; } } if ($sticky_count < $posts_per_page) { $query->set('posts_per_page', $posts_per_page - $sticky_count); } else { $query->set('posts_per_page', 1); } } else { $query->set('posts_per_page', $posts_per_page); } } }
/** * Register theme scripts for the theme * * We will use the wp_enqueue_scripts function in framework/wolf-core.php to enqueue scripts * */ function wolf_enqueue_scripts() { $theme_slug = wolf_get_theme_slug(); // Ensure to overwrite scripts enqueued by a plugin wp_dequeue_script('flexslider'); wp_deregister_script('flexslider'); wp_dequeue_script('swipebox'); wp_deregister_script('swipebox'); wp_dequeue_script('fancybox'); wp_deregister_script('fancybox'); wp_dequeue_script('isotope'); wp_deregister_script('isotope'); wp_dequeue_script('imagesloaded'); wp_deregister_script('imagesloaded'); // Modernizr wp_enqueue_script('modernizr', WOLF_THEME_URI . '/js/lib/modernizr.js', '', '2.8.3', false); // Register scripts wp_register_script('infinite-scroll', WOLF_THEME_URI . '/js/lib/jquery.infinitescroll.min.js', 'jquery', '2.0.2', true); // Countdown wp_register_script('countdown', WOLF_THEME_URI . '/js/lib/jquery.countdown.min.js', 'jquery', '2.0.1', true); // Enqueue theme scripts wp_enqueue_script('jquery'); wp_enqueue_script('wp-mediaelement'); // enqueue WP media // Check lightbox option if ('swipebox' == wolf_get_theme_option('lightbox')) { wp_enqueue_script('swipebox', WOLF_THEME_URI . '/js/lib/jquery.swipebox.min.js', 'jquery', '1.3.0.2', true); } elseif ('fancybox' == wolf_get_theme_option('lightbox')) { wp_enqueue_script('fancybox', WOLF_THEME_URI . '/js/lib/jquery.fancybox.pack.js', 'jquery', '2.1.5', true); wp_enqueue_script('fancybox-media', WOLF_THEME_URI . '/js/lib/jquery.fancybox-media.min.js', 'jquery', '1.0.6', true); } // Parallax fallback for IE ( haParallax that uses translate doesn't work well ) if (wolf_is_ie()) { wp_enqueue_script('parallax-bg', WOLF_THEME_URI . '/js/lib/jquery.parallax.min.js', 'jquery', '1.1.3', true); } // Register theme specific scripts if (wolf_get_theme_option('js_min')) { wp_register_script('infinite-scroll-blog', WOLF_THEME_URI . '/js/min/jquery.infinitescroll-blog.min.js', 'jquery', WOLF_THEME_VERSION, true); wp_register_script('gallery', WOLF_THEME_URI . '/js/min/jquery.gallery.min.js', 'jquery', WOLF_THEME_VERSION, true); wp_register_script('item-masonry', WOLF_THEME_URI . '/js/min/jquery.item-masonry.min.js', 'jquery', WOLF_THEME_VERSION, true); $tmp = WOLF_THEME_VERSION; //$tmp = time(); wp_enqueue_script("{$theme_slug}", WOLF_THEME_URI . '/js/min/app.min.js', 'jquery', "{$tmp}", true); wp_register_script($theme_slug . '-one-page', WOLF_THEME_URI . '/js/min/jquery.one-page.min.js', 'jquery', WOLF_THEME_VERSION, true); } else { wp_register_script('infinite-scroll-blog', WOLF_THEME_URI . '/js/jquery.infinitescroll-blog.js', 'jquery', WOLF_THEME_VERSION, true); wp_register_script('gallery', WOLF_THEME_URI . '/js/jquery.gallery.js', 'jquery', WOLF_THEME_VERSION, true); wp_register_script('item-masonry', WOLF_THEME_URI . '/js/jquery.item-masonry.js', 'jquery', WOLF_THEME_VERSION, true); //wp_enqueue_script( 'nicescroll', WOLF_THEME_URI . '/js/lib/jquery.nicescroll.min.js', 'jquery', '3.5.4', true ); wp_enqueue_script('isotope', WOLF_THEME_URI . '/js/lib/isotope.pkgd.min.js', 'jquery', '2.0.1', true); wp_enqueue_script('imageloaded', WOLF_THEME_URI . '/js/lib/imagesloaded.pkgd.min.js', 'jquery', '3.1.8', true); wp_enqueue_script('wow', WOLF_THEME_URI . '/js/lib/wow.min.js', 'jquery', '1.0.1', true); wp_enqueue_script('waypoints', WOLF_THEME_URI . '/js/lib/waypoints.min.js', 'jquery', '1.6.2', true); wp_enqueue_script('flexslider', WOLF_THEME_URI . '/js/lib/jquery.flexslider.min.js', 'jquery', '2.2.2', true); wp_enqueue_script('owlcarousel', WOLF_THEME_URI . '/js/lib/owl.carousel.min.js', array('jquery'), '2.0.0', true); wp_enqueue_script('parallax', WOLF_THEME_URI . '/js/lib/jquery.haParallax.js', 'jquery', '1.0.0', true); wp_enqueue_script('counterup', WOLF_THEME_URI . '/js/lib/jquery.counterup.min.js', 'jquery', '1.0', true); wp_enqueue_script('cookie', WOLF_THEME_URI . '/js/lib/jquery.memo.min.js', 'jquery', '1.0', true); wp_enqueue_script('fittext', WOLF_THEME_URI . '/js/lib/jquery.fittext.min.js', array('jquery'), '1.2', true); wp_enqueue_script('wolf-slider', WOLF_THEME_URI . '/js/jquery.wolfSlider.js', array('jquery'), WOLF_THEME_VERSION, true); wp_enqueue_script('carousels', WOLF_THEME_URI . '/js/jquery.carousels.js', 'jquery', WOLF_THEME_VERSION, true); wp_enqueue_script('viewsnlikes', WOLF_THEME_URI . '/js/jquery.likesnviews.js', 'jquery', WOLF_THEME_VERSION, true); wp_enqueue_script('youtube-video-bg', WOLF_THEME_URI . '/js/youtube-video-bg.js', 'jquery', WOLF_THEME_VERSION, true); $tmp = WOLF_THEME_VERSION; //$tmp = time(); wp_enqueue_script("{$theme_slug}", WOLF_THEME_URI . '/js/jquery.functions.js', 'jquery', "{$tmp}", true); wp_register_script($theme_slug . '-one-page', WOLF_THEME_URI . '/js/jquery.one-page.js', 'jquery', WOLF_THEME_VERSION, true); } wp_register_script('packery', WOLF_THEME_URI . '/js/lib/packery-mode.pkgd.min.js', 'jquery', '0.1.0', true); if (wolf_get_theme_option('one_page_menu')) { wp_enqueue_script($theme_slug . '-one-page'); } // Check the current post type for the ones that uses masonry $current_post_type = array(); if (wolf_is_blog()) { $current_post_type = array('postType' => 'post', 'name' => 'blog', 'trigger' => wolf_get_theme_option('blog_infinite_scroll_trigger')); } elseif (wolf_is_portfolio()) { $current_post_type = array('postType' => 'work', 'name' => 'work', 'trigger' => wolf_get_theme_option('work_infinite_scroll_trigger')); } elseif (wolf_is_videos()) { $current_post_type = array('postType' => 'video', 'name' => 'videos', 'trigger' => wolf_get_theme_option('video_infinite_scroll_trigger')); } elseif (wolf_is_albums()) { $current_post_type = array('postType' => 'gallery', 'name' => 'albums', 'trigger' => wolf_get_theme_option('gallery_infinite_scroll_trigger')); } elseif (function_exists('wolf_is_plugins') && wolf_is_plugins()) { $current_post_type = array('postType' => 'plugin', 'name' => 'plugins'); } elseif (function_exists('wolf_is_themes') && wolf_is_themes()) { $current_post_type = array('postType' => 'theme', 'name' => 'themes'); } elseif (function_exists('wolf_is_demos') && wolf_is_demos()) { $current_post_type = array('postType' => 'demo', 'name' => 'demos'); } // Add JS global variables wp_localize_script("{$theme_slug}", 'WolfThemeParams', array('ajaxUrl' => admin_url('admin-ajax.php'), 'siteUrl' => esc_url(home_url('/')), 'accentColor' => get_theme_mod('accent_color'), 'headerPercent' => 0 != wolf_get_theme_option('home_header_height') ? wolf_get_theme_option('home_header_height') : 80, 'breakPoint' => wolf_get_theme_option('breakpoint', 10000), 'lightbox' => wolf_get_theme_option('lightbox', 'swipebox'), 'videoLightbox' => wolf_get_theme_option('video_lightbox'), 'footerUncover' => wolf_get_theme_option('footer_uncover'), 'headerUncover' => wolf_get_theme_option('header_uncover'), 'sliderEffect' => wolf_get_theme_option('slider_effect', 'slide'), 'sliderAutoplay' => wolf_get_theme_option('slider_autoplay'), 'sliderSpeed' => wolf_get_theme_option('slider_speed', 5000), 'sliderPause' => wolf_get_theme_option('slider_pause'), 'infiniteScroll' => wolf_get_theme_option('blog_infinite_scroll'), 'infiniteScrollMsg' => __('Loading...', 'wolf'), 'infiniteScrollEndMsg' => __('No more post to load', 'wolf'), 'loadMoreMsg' => __('Load More', 'wolf'), 'infiniteScrollEmptyLoad' => wolf_get_theme_uri('/images/empty.gif'), 'newsletterPlaceholder' => __('Your email', 'wolf'), 'isHomeSlider' => wolf_is_slider_in_home_header(), 'heroFadeWhileScroll' => wolf_get_theme_option('hero_fade_while_scroll'), 'heroParallax' => 'parallax' == wolf_get_theme_option('hero_effect') || 'video' == wolf_get_theme_option('home_header_type'), 'homeHeaderType' => wolf_get_theme_option('home_header_type'), 'isHome' => is_page_template('page-templates/home.php'), 'blogWidth' => wolf_get_theme_option('blog_width'), 'menuPosition' => wolf_get_theme_option('menu_position'), 'modernMenu' => 'modern' == wolf_get_theme_option('menu_position'), 'currentPostType' => $current_post_type, 'enableParallaxOnMobile' => wolf_get_theme_option('enable_parallax_on_mobile'), 'enableAnimationOnMobile' => wolf_get_theme_option('enable_animation_on_mobile'), 'doPageTransition' => wolf_get_theme_option('no_page_transition') || wolf_is_ie() ? false : true, 'doBackToTopAnimation' => wolf_get_theme_option('no_back_to_top_animation') ? false : true, 'onePageMenu' => wolf_get_theme_option('one_page_menu') ? true : false, 'onePagePage' => get_permalink(wolf_get_theme_option('one_page_menu')), 'isOnePageOtherPage' => get_the_ID() != wolf_get_theme_option('one_page_menu'), 'isStickyMenu' => wolf_get_theme_option('sticky_menu'), 'addMenuType' => wolf_get_theme_option('additional_toggle_menu_type'), 'workType' => wolf_get_theme_option('work_type'), 'isTopbar' => wolf_get_theme_option('top_bar'), 'menuStyle' => wolf_get_theme_option('menu_style'), 'years' => __('Years', 'wolf'), 'months' => __('Months', 'wolf'), 'weeks' => __('Weeks', 'wolf'), 'days' => __('Days', 'wolf'), 'hours' => __('Hours', 'wolf'), 'minutes' => __('Minutes', 'wolf'), 'seconds' => __('Seconds', 'wolf'), 'replyTitle' => __('Share your thoughts', 'wolf'), 'doWoocommerceLightbox' => 'no' == get_option('woocommerce_enable_lightbox'), 'leftMenuTransparency' => wolf_get_theme_option('left_menu_transparency'), 'layout' => wolf_get_theme_option('layout'), 'HomeHeaderVideoBgType' => wolf_get_theme_option('video_header_bg_type'))); // Dequeue plugin scripts wp_dequeue_script('wolf-portfolio'); wp_deregister_script('wolf-portfolio'); wp_dequeue_script('wolf-albums'); wp_deregister_script('wolf-albums'); wp_dequeue_script('wolf-videos'); wp_deregister_script('wolf-videos'); // Enqueue scripts conditionaly for the blog if ('masonry' == wolf_get_blog_layout() && wolf_is_blog()) { if (wolf_get_theme_option('blog_infinite_scroll')) { wp_enqueue_script('wp-mediaelement'); wp_enqueue_script('infinite-scroll'); } wp_enqueue_script('item-masonry'); } if (wolf_is_portfolio() && 'modern' != wolf_get_theme_option('work_type') && 'vertical' != wolf_get_theme_option('work_type')) { if (wolf_get_theme_option('work_infinite_scroll') && 'masonry-horizontal' != wolf_get_theme_option('work_type')) { wp_enqueue_script('wp-mediaelement'); wp_enqueue_script('infinite-scroll'); } if ('masonry-horizontal' == wolf_get_theme_option('work_type')) { wp_enqueue_script('packery'); } wp_enqueue_script('item-masonry'); } if (wolf_is_albums() && 'modern' != wolf_get_theme_option('gallery_type') && 'vertical' != wolf_get_theme_option('gallery_type')) { if (wolf_get_theme_option('gallery_infinite_scroll')) { wp_enqueue_script('wp-mediaelement'); wp_enqueue_script('infinite-scroll'); } wp_enqueue_script('item-masonry'); } if (wolf_is_videos()) { if (wolf_get_theme_option('video_infinite_scroll')) { wp_enqueue_script('wp-mediaelement'); wp_enqueue_script('infinite-scroll'); } wp_enqueue_script('item-masonry'); } // Enqueue scripts conditionaly for the gallery if (is_singular('gallery')) { wp_enqueue_script('imageloaded'); wp_enqueue_script('isotope'); wp_enqueue_script('gallery'); } // loads the javascript required for threaded comments if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }
/** * Output pagination on blog page * * @access public * @since 1.0.0 * @return void */ function wolf_output_pagination() { if (wolf_is_blog()) { get_template_part('partials/pagination'); } }
/** * Display a slider with the image frome the gallery shortcode * * @access public * @param array $images * @param string $orderby * @return string $output */ function wolf_flexslider_gallery($images = array(), $orderby, $inline_style = '', $class = '') { if ('rand' == $orderby) { shuffle($images); } $post_id = get_the_ID(); $permalink = get_permalink(); $selector = "gallery-{$post_id}"; $style = ''; $class = $class ? "{$class} " : ''; // add space $class .= "post-gallery-slider flexslider clearfix"; if ($inline_style) { $style .= $inline_style; } $style = $style ? " style='{$style}'" : ''; $output = "<div class='{$class}' id='{$selector}'{$style}><ul class='slides'>"; $size = 'slide'; if ('masonry' == wolf_get_theme_option('blog_type') && wolf_is_blog() || 'masonry' == wolf_get_theme_option('work_type') && wolf_is_portfolio()) { $size = 'classic-thumb'; } foreach ($images as $image_id) { $attachment = get_post($image_id); $image_url = esc_url(wolf_get_url_from_attachment_id($image_id, $size)); $title = wptexturize($attachment->post_title); $alt = esc_attr(get_post_meta($attachment->ID, '_wp_attachment_image_alt', true)); $alt = $alt ? $alt : $title; $post_excerpt = wolf_sample(wptexturize($attachment->post_excerpt), 88); $title_attr = $post_excerpt ? $post_excerpt : ''; $output .= "<li class='slide'>\r\n\t\t\t\t<img src='{$image_url}' alt='{$alt}'>"; if ($post_excerpt) { $output .= "<p class='flex-caption'>{$post_excerpt}</p>"; } $output .= '</li>'; } $output .= '</ul></div>'; return $output; }
/** * Add specific class to the body depending on theme options and page template * * @param array $classes * @return array $classes */ function wolf_body_classes($classes) { global $wp_customize, $post; if (isset($wp_customize)) { $classes[] = 'is-customizer'; } /** * Check if VC is used */ $is_vc = false; if (is_object($post)) { $pattern = get_shortcode_regex(); if (preg_match("/{$pattern}/s", $post->post_content, $match)) { if ('vc_row' == $match[2]) { $is_vc = true; } } } // $classes[] = 'do-transform'; $classes[] = 'wolf'; $classes[] = 'wolf-mailchimp'; $classes[] = wolf_get_theme_slug(); $classes[] = 'wolf-woocommerce-' . wolf_get_theme_option('woocommerce_layout'); /* Main Layout */ $classes[] = wolf_get_theme_option('layout') . '-layout'; /* Main Layout */ $skin = wolf_get_theme_option('skin') ? wolf_get_theme_option('skin') : 'light'; $classes[] = "skin-{$skin}"; /* Menu */ $classes[] = 'menu-' . wolf_get_theme_option('menu_style'); $classes[] = 'menu-' . wolf_get_theme_option('menu_position'); $classes[] = 'menu-' . wolf_get_theme_option('menu_skin'); if ('default' == wolf_get_theme_option('menu_position')) { $classes[] = 'menu-' . wolf_get_theme_option('menu_width'); if ('wide' == wolf_get_theme_option('menu_width')) { $classes[] = 'submenu-' . wolf_get_theme_option('submenu_align'); } } if ('logo-centered' == wolf_get_theme_option('menu_position') && wolf_get_theme_option('logo_overflow')) { $classes[] = 'menu-logo-overflow'; } $classes[] = 'menu-hover-' . wolf_get_theme_option('menu_hover_effect'); /* Secondary Menu */ if (wolf_get_theme_option('additional_toggle_menu')) { $classes[] = 'is-secondary-menu'; } else { $classes[] = 'no-secondary-menu'; } /* Page header type */ $header_post_id = wolf_get_header_post_id(); $page_header_type = wolf_get_theme_option('page_header_type'); $hide_title_area = 'none' == wolf_get_theme_option('page_header_type'); if ($header_post_id && get_post_meta($header_post_id, '_page_header_type', true)) { $page_header_type = get_post_meta($header_post_id, '_page_header_type', true); $hide_title_area = 'none' == get_post_meta($header_post_id, '_page_header_type', true); } if (wolf_get_category_meta('page_header_type')) { $page_header_type = wolf_get_category_meta('page_header_type'); } //$page_header_type = ( 'full' == $page_header_type ) ? 'big' : $page_header_type; $classes[] = "page-header-{$page_header_type}"; /*if ( 'full' == get_post_meta( $header_post_id, '_page_header_type', true ) || 'full' == wolf_get_theme_option( 'page_header_type' ) ) { $classes[] = "page-header-full"; }*/ if ($hide_title_area) { $classes[] = 'no-title-area'; } else { $classes[] = 'show-title-area'; } if ('left' == wolf_get_theme_option('menu_position') && $hide_title_area) { $classes[] = 'left-menu-not-title-area'; } if (get_post_meta($header_post_id, '_menu_absolute', true) && $hide_title_area) { $classes[] = 'is-home-header'; $classes[] = 'force-absolute-menu'; } /* Page template clean classes */ if (is_page_template('page-templates/full-width.php') || is_page_template('page-templates/page-with-comments.php')) { $classes[] = 'page-full-width'; } if (is_page_template('page-templates/small-width.php')) { $classes[] = 'page-small-width'; } if (is_page_template('page-templates/post-archives.php')) { $classes[] = 'post-archives'; } if (is_page_template('page-templates/page-sidebar-right.php')) { $classes[] = 'page-sidebar-right'; } if (is_page_template('page-templates/page-sidebar-left.php')) { $classes[] = 'page-sidebar-left'; } if (is_page_template('page-templates/coming-soon.php')) { $classes[] = 'coming-soon'; } // Visual Composer Pages if ('default' == get_post_meta(get_the_ID(), '_wp_page_template', true)) { if (!is_search() && !wolf_is_portfolio() && !wolf_is_albums() && !wolf_is_blog() && !wolf_is_videos() && !wolf_is_plugins() && !wolf_is_themes() && !wolf_is_discography() && !wolf_is_woocommerce()) { if ($is_vc) { $classes[] = 'is-vc-page'; } else { $classes[] = 'page-full-width'; } } } elseif (is_page_template('page-templates/home.php') && $is_vc) { $classes[] = 'is-vc-page'; } if (wolf_get_theme_option('full_screen_header') && is_page_template('page-templates/home.php') && wolf_is_home_header()) { $classes[] = 'full-window-header'; } if (wolf_get_theme_option('sticky_menu')) { $classes[] = 'is-sticky-menu'; } if (wolf_get_theme_option('top_bar')) { $classes[] = 'is-top-bar'; } else { $classes[] = 'no-top-bar'; } if (wolf_get_theme_option('fullwidth_menu')) { $classes[] = 'is-fullwidth-menu'; } if ('yes' == wolf_get_theme_option('additional_toggle_menu') && 'side' == wolf_get_theme_option('additional_toggle_menu_type') && ('default' == wolf_get_theme_option('menu_position') || 'center' == wolf_get_theme_option('menu_position') || 'logo-centered' == wolf_get_theme_option('menu_position'))) { $classes[] = 'is-side-menu'; } /* Add a class to hide the sidebar on mobile */ if (wolf_get_theme_option('blog_hide_sidebar_phone')) { $classes[] = 'hide-sidebar-phone'; } /* No loader option class */ if (!wolf_get_theme_option('loader')) { $classes[] = 'no-loader'; } /* No transition option class */ if (!wolf_get_theme_option('page_transition')) { $classes[] = 'no-page-transition'; } /* Home Header Type */ if (wolf_get_theme_option('home_header_type') && is_page_template('page-templates/home.php') || is_front_page()) { $classes[] = 'home-header-' . wolf_get_theme_option('home_header_type'); } if (is_multi_author()) { $classes[] = 'is-multi-author'; } if (wolf_is_blog()) { $classes[] = 'is-blog'; $blog_type = wolf_get_blog_layout(); if ('masonry' == $blog_type) { $classes[] = 'masonry'; } $classes[] = "blog-{$blog_type}"; $classes[] = 'blog-' . wolf_get_theme_option('blog_width'); /* Infinite Scroll class */ if (wolf_get_theme_option('blog_infinite_scroll')) { $classes[] = 'post-infinite-scroll'; } } if (is_page_template('page-templates/home.php') || is_front_page()) { $classes[] = 'is-theme-home'; if (wolf_is_home_header()) { $classes[] = 'is-home-header'; } else { $classes[] = 'no-home-header'; } if (wolf_is_slider_in_home_header()) { $classes[] = 'is-home-slider'; } } if (get_post_meta($header_post_id, '_hide_footer', true)) { $classes[] = 'no-footer'; } if (get_post_meta($header_post_id, '_hide_menu', true)) { $classes[] = 'no-menu'; } if (!is_page_template('page-templates/home.php')) { /** * Is header image ? */ $header_bg_type = get_post_meta($header_post_id, '_header_bg_type', true); $header_bg_color = get_post_meta($header_post_id, '_header_bg_color', true); $header_bg_img = get_post_meta($header_post_id, '_header_bg_img', true); $header_bg_mp4 = get_post_meta($header_post_id, '_header_video_bg_mp4', true); /* If category meta video bg */ if ('image' == wolf_get_category_meta('header_bg_type') && (wolf_get_category_meta('header_bg_img') || wolf_get_category_meta('header_bg_color'))) { $header_bg_type = 'image'; $header_bg_img = wolf_get_category_meta('header_bg_img'); } /* If category meta video bg */ if ('video' == wolf_get_category_meta('header_bg_type') && wolf_get_category_meta('header_video_bg_mp4')) { $header_bg_type = 'video'; $header_bg_mp4 = wolf_get_category_meta('header_video_bg_mp4'); } if ($header_post_id && !is_search()) { if ('image' == $header_bg_type) { if ($header_bg_img || $header_bg_color) { $classes[] = 'has-header-image'; } else { $classes[] = 'no-header-image'; } } elseif ('video' == $header_bg_type) { if ($header_bg_mp4) { $classes[] = 'has-header-image'; } else { $classes[] = 'no-header-image'; } } } /* is 404 header image? */ if (is_404()) { if (wolf_get_theme_option('404_bg')) { $classes[] = 'has-header-image'; } else { $classes[] = 'no-header-image'; } } } if (wolf_is_portfolio()) { if ('modern' != wolf_get_theme_option('work_type') && 'vertical' != wolf_get_theme_option('work_type')) { $classes[] = 'masonry'; } $classes[] = 'work-' . wolf_get_theme_option('work_width'); $classes[] = 'work-' . wolf_get_theme_option('work_type'); $classes[] = 'work-' . wolf_get_theme_option('work_padding'); /* Infinite Scroll class */ if (wolf_get_theme_option('work_infinite_scroll') && 'masonry-horizontal' != wolf_get_theme_option('work_type')) { $classes[] = 'work-infinite-scroll'; } if (wolf_get_theme_option('work_isotope') && 'masonry-horizontal' != wolf_get_theme_option('work_type')) { $classes[] = 'work-isotope'; } } if (wolf_is_albums()) { if ('modern' != wolf_get_theme_option('gallery_type') && 'vertical' != wolf_get_theme_option('gallery_type')) { $classes[] = 'masonry'; } $classes[] = 'gallery-' . wolf_get_theme_option('gallery_type'); $classes[] = 'gallery-' . wolf_get_theme_option('gallery_width'); $classes[] = 'gallery-' . wolf_get_theme_option('gallery_padding'); if (wolf_get_theme_option('gallery_infinite_scroll')) { $classes[] = 'gallery-infinite-scroll'; } if (wolf_get_theme_option('gallery_isotope')) { $classes[] = 'gallery-isotope'; } } if (wolf_is_video_search()) { $classes[] = 'wolf-videos-search-results'; } if (wolf_is_videos()) { $classes[] = 'masonry'; $classes[] = 'video-' . wolf_get_theme_option('video_width'); $classes[] = 'video-' . wolf_get_theme_option('video_padding'); $classes[] = 'video-' . wolf_get_theme_option('video_type'); if (wolf_get_theme_option('video_infinite_scroll')) { $classes[] = 'video-infinite-scroll'; } if (wolf_get_theme_option('video_isotope')) { $classes[] = 'video-isotope'; } } if (wolf_is_discography()) { $classes[] = 'release-' . wolf_get_theme_option('release_width'); $classes[] = 'release-' . wolf_get_theme_option('release_padding'); $classes[] = 'release-' . wolf_get_theme_option('release_type'); } elseif (is_singular('video')) { $classes[] = 'video-' . wolf_get_theme_option('video_type'); } if (is_singular('gallery')) { if (!wolf_get_theme_option('gallery_comments') && !wolf_get_theme_option('gallery_share')) { $classes[] = 'single-gallery-no-padding-bottom'; } } if (is_singular('post') && 'sidebar' == wolf_get_single_blog_post_layout()) { $classes[] = 'post-has-sidebar'; } return $classes; }