/** * Add favicons (images/favicons) * * @return string */ function wolf_favicons() { $favicon = wolf_get_theme_option('favicon') ? wolf_get_theme_option('favicon') : wolf_get_theme_uri('/images/favicons/favicon.ico'); $favicon_57 = wolf_get_theme_option('favicon_57') ? wolf_get_url_from_attachment_id(wolf_get_theme_option('favicon_57')) : wolf_get_theme_uri('/images/favicons/touch-icon-57x57.png'); $favicon_72 = wolf_get_theme_option('favicon_72') ? wolf_get_url_from_attachment_id(wolf_get_theme_option('favicon_72')) : wolf_get_theme_uri('/images/favicons/touch-icon-72x72.png'); $favicon_114 = wolf_get_theme_option('favicon_114') ? wolf_get_url_from_attachment_id(wolf_get_theme_option('favicon_114')) : wolf_get_theme_uri('/images/favicons/touch-icon-114x114.png'); ?> <!-- Favicons --> <link rel="shortcut icon" href="<?php echo esc_url($favicon); ?> "> <link rel="apple-touch-icon" href="<?php echo esc_url($favicon_57); ?> "> <link rel="apple-touch-icon" sizes="72x72" href="<?php echo esc_url($favicon_72); ?> "> <link rel="apple-touch-icon" sizes="114x114" href="<?php echo esc_url($favicon_114); ?> "> <?php }
/** * Single Image shortcode * * @param array $atts * @return string */ function wolf_shortcode_linked_image($atts) { if (class_exists('Vc_Manager') && function_exists('vc_map_get_attributes')) { $atts = vc_map_get_attributes('wolf_linked_image', $atts); } extract(shortcode_atts(array('image' => '', 'alignment' => 'center', 'text_alignment' => 'center', 'image_style' => '', 'full_size' => '', 'link' => '', 'text' => '', 'secondary_text' => '', 'overlay_color' => '#000', 'overlay_opacity' => '40', 'text_color' => '#fff', 'text_tag' => 'h3', 'font' => '', 'class' => '', 'image_size' => 'large', 'animation' => '', 'animation_delay' => '', 'inline_style' => '', 'class' => ''), $atts)); $href = $image_css = ''; $image_class = $class; $image_style = sanitize_text_field($image_style); $container_class = "wolf-linked-image text-{$alignment} {$image_style}"; $overlay_opacity = absint($overlay_opacity) / 100; $text = sanitize_text_field($text); $link = vc_build_link($link); $url = esc_url($link['url']); $target = $link['target']; $title = $link['title']; $secondary_text = sanitize_text_field($secondary_text); $secondary_text = "<span class='wolf-linked-image-secondary-text text-{$text_alignment}' style='color:{$text_color}'>{$secondary_text}</span>"; $text_color = $text_color ? sanitize_text_field($text_color) : '#fff'; $caption = "<{$text_tag} class='wolf-linked-image-caption text-{$text_alignment}' style='color:{$text_color}'>{$text}</{$text_tag}>"; if ($inline_style) { $image_css .= $inline_style; } if ('round' == $image_style) { $image_size = '2x2'; } $image_css = $inline_style ? " style='{$inline_style}'" : ''; if ($animation) { $container_class .= " wow {$animation}"; } $src = wolf_get_url_from_attachment_id(absint($image), $image_size); $src = $src ? $src : wolf_get_theme_uri('/images/placeholders/' . $image_size . '.jpg'); $output = "<div class='{$container_class}'>"; if ('http://' != $url && $url) { $output .= '<a href="' . esc_url($url) . '" title="' . esc_attr($title) . '" target="' . esc_attr($target) . '" class="image-item">'; } else { $output .= "<span class='image-item'>"; } $output .= "<img src='{$src}' alt='single-image' {$image_css} class='{$image_class}'>"; $output .= "<span class='wolf-linked-image-overlay' style='opacity:{$overlay_opacity};background-color:{$overlay_color}'></span>"; $output .= "<span class='wolf-linked-image-caption-container'><span class='wolf-linked-image-caption-table'>\r\n\t\t<span class='wolf-linked-image-caption-table-cell'>\r\n\t\t{$caption}\r\n\t\t{$secondary_text}\r\n\t\t</span>\r\n\t\t</span>\r\n\t\t</span>"; if ($full_size || 'http://' != $link && $link) { $output .= "</a>"; } else { $output .= "</span>"; } $output .= '</div>'; return $output; }
function wolf_theme_default_options_init() { $theme_options = get_option('wolf_theme_options_' . wolf_get_theme_slug()); $default_header_content = '<h1 style="text-align:center;">THANK YOU FOR PURCHASING DECIBEL!</h1> <p style="text-align:center;">You can check the documentation <a target="_blank" href="http://docs.wolfthemes.com/documentation/themes/decibel/">here</a></p>'; $default_header_img = wolf_get_theme_uri('/images/presets/header.jpg'); $default_options = array('accent_color' => '#c74735', 'responsive' => 'true', 'layout' => 'wide', 'lightbox' => 'fancybox', 'home_header_type' => 'video', 'video_header_bg_mp4' => 'http://assets.cdn.wolfthemes.com/mp4/gram.mp4', 'hero_fade_while_scroll' => 'true', 'home_header_content' => $default_header_content, 'home_header_height' => 85, 'header_bg_font_color' => 'light', 'header_overlay_color' => '#000', 'header_overlay_opacity' => 30, 'slider_speed' => 5000, 'favicon' => 'http://assets.cdn.wolfthemes.com/favicon.ico', 'breakpoint' => 1140, 'sticky_menu' => 'true', 'menu_width' => 'boxed', 'menu_style' => 'transparent', 'menu_hover_effect' => 'default', 'search_menu_item' => 'true', 'cart_menu_item' => 'true', 'menu_position' => 'default', 'menu_skin' => 'light', 'additional_toggle_menu' => 'true', 'additional_toggle_menu_type' => 'side', 'page_header_type' => 'medium', 'date_format' => 'human_diff', 'excerpt_type' => 'auto', 'blog_type' => 'sidebar', 'blog_width' => 'boxed', 'post_views' => 'true', 'post_likes' => 'true', 'post_share' => 'true', 'show_author_box' => 'true', 'gallery_isotope' => 'true', 'gallery_type' => 'vertical', 'video_isotope' => 'true', 'video_type' => 'youtube-all', 'video_author' => 'true', 'video_views' => 'true', 'video_likes' => 'true', 'video_comments' => 'true', 'video_share' => 'true', 'video_embed' => 'true', 'release_type' => 'grid', 'release_cols' => 3, 'release_width' => 'boxed', 'release_padding' => 'padding', 'products_per_page' => 12, 'social_meta' => 'true', 'show_author_box' => 'true', 'show_share_box_single' => 'true', 'share_text' => 'Share', 'share_facebook' => 'true', 'share_twitter' => 'true', 'share_pinterest' => 'true', 'google_fonts' => '', 'heading_font_name' => 'Montserrat', 'menu_font_name' => 'Open Sans', 'menu_font_transform' => 'uppercase', 'entry_meta_font_name' => 'Montserrat', 'facebook' => '#', 'twitter' => '#', 'bottom_socials' => 'true', 'copyright_textbox' => '© Powered by Wordpress', 'page_transition' => 'yes', 'loader' => 'yes', 'loader_type' => 'loader8', 'js_min' => 'true', 'css_min' => 'true'); if (!$theme_options) { add_option('wolf_theme_options_' . wolf_get_theme_slug(), $default_options); } // default WP settings //update_option( 'image_default_link_type', 'lightbox' ); // woo thumbnails $catalog = array('width' => '400', 'height' => '400', 'crop' => 1); $single = array('width' => '600', 'height' => '600', 'crop' => 1); $thumbnail = array('width' => '120', 'height' => '120', 'crop' => 0); // Image sizes update_option('shop_catalog_image_size', $catalog); // Product category thumbs update_option('shop_single_image_size', $single); // Single product image update_option('shop_thumbnail_image_size', $thumbnail); update_option('woocommerce_enable_lightbox', 'no'); }
/** * 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'); } }
/** * Get a different post thumbnail depending on context * * @param boolean $echo Whether to echo the date. Default true. * @return string */ function wolf_entry_thumbnail($echo = true) { $thumbnail = ''; $format = get_post_format() ? get_post_format() : 'standard'; $no_thumb = array('video', 'gallery', 'link', 'status', 'quote', 'aside', 'link', 'chat'); $is_instagram = 'image' == $format && preg_match(wolf_get_regex('instagram'), get_the_content()); if (has_post_thumbnail()) { if ('work' == get_post_type() && !is_single()) { $thumbnail = get_the_post_thumbnail(get_the_ID(), 'classic-thumb'); } elseif ('image' == $format && is_single()) { $img_excerpt = get_post(get_post_thumbnail_id())->post_excerpt; $img_alt = esc_attr(get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)); $caption = $img_excerpt ? $img_excerpt : get_the_title(); $caption = ''; $img = wolf_get_post_thumbnail_url('big'); $full_img = wolf_get_post_thumbnail_url('full'); $lightbox_class = 'lightbox'; $thumbnail = '<div class="entry-thumbnail">'; $thumbnail .= "<a title='{$caption}' class='{$lightbox_class} zoom' href='{$full_img}'>"; $thumbnail .= "<img src='{$img}' alt='{$img_alt}'>"; $thumbnail .= '</a>'; $thumbnail .= '</div>'; } elseif ('video' == $format && !is_single()) { $thumbnail = get_the_post_thumbnail(get_the_ID(), '1x1'); } elseif (!is_single()) { $thumbnail = get_the_post_thumbnail(get_the_ID(), '2x2'); } } elseif (is_page_template('page-templates/home.php')) { $thumbnail = '<img src="' . wolf_get_theme_uri('/images/empty.gif') . '">'; } if ($echo) { echo wp_kses($thumbnail, array('div' => array('class' => array()), 'img' => array('src' => array(), 'alt' => array(), 'class' => array()), 'a' => array('href' => array(), 'class' => array(), 'rel' => array(), 'title' => array()))); } return $thumbnail; }
function custom_woocommerce_placeholder_img_src($src) { $src = wolf_get_theme_uri('/images/woocommerce/placeholder.jpg'); return $src; }