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', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'css/genericons/genericons.css', false, '3.4.1' ); /** * Loads up Responsive stylesheet */ wp_enqueue_style( 'adventurous-responsive', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'css/responsive.css' ); /** * Loads up Responsive Video Script */ wp_enqueue_script( 'jquery-fitvids', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'js/fitvids.min.js', array( 'jquery' ), '20140317', true ); /** * Loads up jQuery Custom Scripts */ wp_enqueue_script( 'adventurous-custom', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'js/adventurous-custom.min.js', array( 'jquery' ), '20150601', true ); wp_enqueue_script( 'adventurous-navigation', get_template_directory_uri() . '/js/navigation.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', trailingslashit( esc_url ( 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', trailingslashit( esc_url ( 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 ( ( 'enable-slider-allpage' == $enableslider ) || ( ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) && 'enable-slider-homepage' == $enableslider ) ) { wp_enqueue_script( 'adventurous-slider', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'js/adventurous-slider.js', array( 'jquery-cycle' ), '20140317', true ); } // Load the html5 shiv. wp_enqueue_script( 'adventurous-html5', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'js/html5.min.js', array(), '3.7.3' ); wp_style_add_data( 'adventurous-html5', 'conditional', 'lt IE 9' ); wp_enqueue_script( 'selectivizr', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'js/selectivizr.min.js', array( 'jquery' ), '20130114', false ); wp_style_add_data( 'selectivizr', 'conditional', 'lt IE 9' ); wp_enqueue_style( 'adventurous-iecss', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'css/ie.css' ); wp_style_add_data( 'adventurous-iecss', 'conditional', 'lt IE 9' ); } 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 ); 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 $options = adventurous_get_options(); $featured_image = $options['featured_image']; if ( ( 'disable' == $individual_featured_image || '' == get_the_post_thumbnail() || ( $individual_featured_image=='default' && 'disable' == $featured_image) ) ) { return false; } else { ?> =4.7 as we have migrated this option to core */ if ( function_exists( 'wp_update_custom_css_post' ) ) { return; } //delete_transient( 'adventurous_inline_css' ); if ( ( !$output = get_transient( 'adventurous_inline_css' ) ) ) { $options = adventurous_get_options(); if ( !empty( $options['custom_css'] ) ) { $output .= '' . "\n"; $output .= '' . "\n"; } set_transient( 'adventurous_inline_css', $output, 86940 ); } echo $output; } 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 $options = adventurous_get_options(); return $options['excerpt_length']; } add_filter( 'excerpt_length', 'adventurous_excerpt_length' ); /** * Returns a "Continue Reading" link for excerpts */ function adventurous_continue_reading() { // Getting data from Theme Options $options = adventurous_get_options(); $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 $options = adventurous_get_options(); $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 ) { $options = adventurous_get_options(); 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 ( 'full' == $current_content_layout ) { $classes[] = 'content-full'; } elseif ( 'excerpt' == $current_content_layout ) { $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('/^