get_queried_object_id(); /** * Loads up main stylesheet. */ wp_enqueue_style( 'adventurous-style', get_stylesheet_uri() ); // Add Genericons font, used in the main stylesheet. wp_enqueue_style( 'genericons', get_template_directory_uri() . '/css/genericons/genericons.css', false, '3.4.1' ); /** * Loads up Responsive stylesheet */ wp_enqueue_style( 'adventurous-responsive', get_template_directory_uri() . '/css/responsive.css' ); /** * Loads up Responsive Video Script */ wp_enqueue_script( 'fitvids', get_template_directory_uri() . '/js/fitvids.min.js', array( 'jquery' ), '20140317', true ); /** * Loads up jQuery Custom Scripts */ wp_enqueue_script( 'adventurous-custom', get_template_directory_uri() . '/js/adventurous-custom.min.js', array( 'jquery' ), '20150601', true ); /** * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } /** * Register JQuery circle all and JQuery set up as dependent on Jquery-cycle */ wp_register_script( 'jquery-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.min.js', array( 'jquery' ), '20140317', true ); /** * Loads up adventurous-slider and jquery-cycle set up as dependent on adventurous-slider */ $enableslider = $options[ 'enable_slider' ]; if ( ( $enableslider == 'enable-slider-allpage' ) || ( ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) && $enableslider == 'enable-slider-homepage' ) ) { wp_enqueue_script( 'adventurous-slider', get_template_directory_uri() . '/js/adventurous-slider.js', array( 'jquery-cycle' ), '20140317', true ); } // Load the html5 shiv. wp_enqueue_script( 'catchresponsive-html5', get_template_directory_uri() . '/js/html5.min.js', array(), '3.7.3' ); wp_script_add_data( 'catchresponsive-html5', 'conditional', 'lt IE 9' ); /** * Browser Specific Enqueue Script */ $adventurous_ua = strtolower($_SERVER['HTTP_USER_AGENT']); if(preg_match('/(?i)msie [1-8]/',$adventurous_ua)) { wp_enqueue_script( 'selectivizr', get_template_directory_uri() . '/js/selectivizr.min.js', array( 'jquery' ), '20130114', false ); wp_enqueue_style( 'adventurous-iecss', get_template_directory_uri() . '/css/ie.css' ); } } add_action( 'wp_enqueue_scripts', 'adventurous_scripts' ); /** * Responsive Layout * * @get the data value of responsive layout from theme options * @display responsive meta tag * @action wp_head */ function adventurous_responsive() { echo ''; } // adventurous_responsive add_filter( 'wp_head', 'adventurous_responsive', 1 ); /** * Get the favicon Image from theme options * * @uses favicon * @get the data value of image from theme options * @display favicon * * @uses default favicon if favicon field on theme options is empty * * @uses set_transient and delete_transient * * @remove Remove this function when WordPress 4.8 is released */ function adventurous_favicon() { if ( function_exists( 'has_site_icon' ) ) { //Bail Early if Core Site Icon Feature is Present return; } if( ( !$adventurous_favicon = get_transient( 'adventurous_favicon' ) ) ) { global $adventurous_options_settings; $options = $adventurous_options_settings; echo ''; if ( $options[ 'remove_favicon' ] == "0" ) : // if not empty fav_icon on theme options if ( !empty( $options[ 'fav_icon' ] ) ) : $adventurous_favicon = ''; else: // if empty fav_icon on theme options, display default fav icon $adventurous_favicon = ''; endif; endif; set_transient( 'adventurous_favicon', $adventurous_favicon, 86940 ); } echo $adventurous_favicon ; } // adventurous_favicon //Load Favicon in Header Section add_action('wp_head', 'adventurous_favicon'); //Load Favicon in Admin Section add_action( 'admin_head', 'adventurous_favicon' ); if ( ! function_exists( 'adventurous_content_image' ) ) : /** * Template for Featured Image in Content * * To override this in a child theme * simply create your own adventurous_content_image(), and that function will be used instead. * * @since Adventurous 1.0 */ function adventurous_content_image() { global $post, $wp_query; // Get Page ID outside Loop $page_id = $wp_query->get_queried_object_id(); if( $post) { if ( is_attachment() ) { $parent = $post->post_parent; $individual_featured_image = get_post_meta( $parent,'adventurous-featured-image', true ); } else { $individual_featured_image = get_post_meta( $page_id,'adventurous-featured-image', true ); } } if( empty( $individual_featured_image ) || ( !is_page() && !is_single() ) ) { $individual_featured_image='default'; } // Getting data from Theme Options global $adventurous_options_settings; $options = $adventurous_options_settings; $featured_image = $options['featured_image']; if ( ( $individual_featured_image == 'disable' || '' == get_the_post_thumbnail() || ( $individual_featured_image=='default' && $featured_image == 'disable') ) ) { return false; } else { ?> ' . "\n"; $adventurous_inline_css .= '' . "\n"; } set_transient( 'adventurous_inline_css', $adventurous_inline_css, 86940 ); } echo $adventurous_inline_css; } add_action('wp_head', 'adventurous_inline_css'); /** * Sets the post excerpt length to 30 words. * * function tied to the excerpt_length filter hook. * @uses filter excerpt_length */ function adventurous_excerpt_length( $length ) { // Getting data from Theme Options global $adventurous_options_settings; $options = $adventurous_options_settings; return $options[ 'excerpt_length' ]; } add_filter( 'excerpt_length', 'adventurous_excerpt_length' ); /** * Change the defult excerpt length of 30 to whatever passed as value * * @use excerpt(10) or excerpt (..) if excerpt length needs only 10 or whatevere * @uses get_permalink, get_the_excerpt */ function adventurous_excerpt_desired( $num ) { $limit = $num+1; $excerpt = explode( ' ', get_the_excerpt(), $limit ); array_pop( $excerpt ); $excerpt = implode( " ",$excerpt ).""; return $excerpt; } /** * Returns a "Continue Reading" link for excerpts */ function adventurous_continue_reading() { // Getting data from Theme Options global $adventurous_options_settings; $options = $adventurous_options_settings; $more_tag_text = $options[ 'more_tag_text' ]; return ' ' . $more_tag_text . ''; } /** * Replaces "[...]" (appended to automatically generated excerpts) with adventurous_continue_reading(). * */ function adventurous_excerpt_more( $more ) { return adventurous_continue_reading(); } add_filter( 'excerpt_more', 'adventurous_excerpt_more' ); /** * Adds Continue Reading link to post excerpts. * * function tied to the get_the_excerpt filter hook. */ function adventurous_custom_excerpt( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= adventurous_continue_reading(); } return $output; } add_filter( 'get_the_excerpt', 'adventurous_custom_excerpt' ); /** * Replacing Continue Reading link to the_content more. * * function tied to the the_content_more_link filter hook. */ function adventurous_more_link( $more_link, $more_link_text ) { // Getting data from Theme Options global $adventurous_options_settings; $options = $adventurous_options_settings; $more_tag_text = $options[ 'more_tag_text' ]; return str_replace( $more_link_text, $more_tag_text, $more_link ); } add_filter( 'the_content_more_link', 'adventurous_more_link', 10, 2 ); /** * Adds custom classes to the array of body classes. * * @since Adventurous 1.0 */ function adventurous_body_classes( $classes ) { global $adventurous_options_settings; $options = $adventurous_options_settings; if ( ( class_exists( 'Woocommerce' ) && is_woocommerce() ) && !is_active_sidebar( 'adventurous_woocommerce_sidebar' ) ) { $classes[] = 'woocommerce-nosidebar'; } if ( is_page_template( 'page-blog.php') ) { $classes[] = 'page-blog'; } // Adds a class of group-blog to blogs with more than 1 published author if ( is_multi_author() ) { $classes[] = 'group-blog'; } $classes[] = adventurous_get_theme_layout(); $current_content_layout = $options['content_layout']; if( $current_content_layout == 'full' ) { $classes[] = 'content-full'; } elseif ( $current_content_layout == 'excerpt' ) { $classes[] = 'content-excerpt'; } return $classes; } add_filter( 'body_class', 'adventurous_body_classes' ); /** * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages * * @since Adventurous 1.0 */ function adventurous_enhanced_image_navigation( $url, $id ) { if ( ! is_attachment() && ! wp_attachment_is_image( $id ) ) return $url; $image = get_post( $id ); if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) $url .= '#main'; return $url; } add_filter( 'attachment_link', 'adventurous_enhanced_image_navigation', 10, 2 ); /** * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. * * @since Adventurous 1.0 */ function adventurous_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'adventurous_page_menu_args' ); /** * Removes div from wp_page_menu() and replace with ul. * * @since Adventurous 1.0 */ function adventurous_wp_page_menu ($page_markup) { preg_match('/^
/i', $page_markup, $matches); $divclass = $matches[1]; $replace = array('
', '
'); $new_markup = str_replace($replace, '', $page_markup); $new_markup = preg_replace('/^