__('The Menu Bar', 'adventure' ) ) ); // WordPress 3.4+ if ( function_exists('get_custom_header')) { add_theme_support('custom-background'); } } endif; add_action('after_setup_theme', 'adventure_setup'); // Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link function adventure_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'adventure_page_menu_args' ); /** * Filter 'get_comments_number' * * Filter 'get_comments_number' to display correct * number of comments (count only comments, not * trackbacks/pingbacks) * * Courtesy of Chip Bennett */ function adventure_comment_count( $count ) { if ( ! is_admin() ) { global $id; $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id)); return count($comments_by_type['comment']); } else { return $count; } } add_filter('get_comments_number', 'adventure_comment_count', 0); /** * wp_list_comments() Pings Callback * * wp_list_comments() Callback function for * Pings (Trackbacks/Pingbacks) */ function adventure_comment_list_pings( $comment ) { $GLOBALS['comment'] = $comment; ?>
  • id="li-comment-">
  • ' . "\n"; echo '' . "\n"; echo '' . "\n"; echo "\n"; } add_action('wp_head', 'adventure_ie_css'); // This function removes inline styles set by WordPress gallery function adventure_remove_gallery_css($css) { return preg_replace("##s", '', $css); } add_filter('gallery_style', 'adventure_remove_gallery_css'); // This function removes default styles set by WordPress recent comments widget function adventure_remove_recent_comments_style() { global $wp_widget_factory; remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } add_action( 'widgets_init', 'adventure_remove_recent_comments_style' ); // A comment reply function adventure_enqueue_comment_reply() { if ( is_singular() && comments_open() && get_option('thread_comments')) wp_enqueue_script('comment-reply'); } add_action( 'wp_enqueue_scripts', 'adventure_enqueue_comment_reply' ); // Wrap Video with a DIV for a CSS Resposive Video function wrap_embed_with_div($html, $url, $attr) { // YouTube isn't in here because it provides sufficient mark-ups to just use their html elements if (preg_match("/vimeo/", $html)) { return '
    ' . $html . '
    '; } if (preg_match("/wordpress.tv/", $html)) { return '
    ' . $html . '
    '; } } // Don't see your video host in here? Just add it in, make sure you have the forward slash marks add_filter('embed_oembed_html', 'wrap_embed_with_div', 10, 3); // Redirect to the theme options Page after theme is activated if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) wp_redirect( 'themes.php?page=theme_options' ); // WordPress Widgets start right here. function adventure_widgets_init() { register_sidebars(1, array( 'name'=>'sidebar', 'id' => 'widget', 'description' => 'Widgets in this area will be shown below the the content of every page.', 'before_widget' => '', 'after_widget' => '', 'before_title' => '

    ', 'after_title' => '

    ', )); } add_action('widgets_init', 'adventure_widgets_init'); // Checks if the Widgets are active function adventure_is_sidebar_active($index) { global $wp_registered_sidebars; $widgetcolums = wp_get_sidebars_widgets(); if ($widgetcolums[$index]) { return true; } return false; } // Load up links in admin bar so theme is edit function adventure_theme_options_add_page() { add_theme_page('Theme Customizer', 'Theme Customizer', 'edit_theme_options', 'customize.php' ); add_theme_page('Theme Info', 'Theme Info', 'edit_theme_options', 'theme_options', 'adventure_theme_options_do_page');} // Add link to theme options in Admin bar function adventure_admin_link() { global $wp_admin_bar; $wp_admin_bar->add_menu( array( 'id' => 'Adventure_Customizer', 'title' => 'Theme Customizer', 'href' => admin_url( 'customize.php' ) )); $wp_admin_bar->add_menu( array( 'id' => 'Adventure_Information', 'title' => 'Theme Information', 'href' => admin_url( 'themes.php?page=theme_options' ) )); } add_action( 'admin_bar_menu', 'adventure_admin_link', 113 ); // Sets up the Customize.php for Adventure (More to come) function adventure_customize($wp_customize) { // Before we begin let's create a textarea input class adventure_Customize_Textarea_Control extends WP_Customize_Control { public $type = 'textarea'; public function render_content() { ?> add_section( 'header_section', array( 'title' => 'Header', 'priority' => 26, )); $wp_customize->add_section( 'nav', array( 'title' => 'Menu', 'priority' => 27, )); $wp_customize->add_section( 'background_image', array( 'title' => 'Background', 'priority' => 28, )); $wp_customize->add_section( 'content_section', array( 'title' => 'Content', 'priority' => 29, )); $wp_customize->add_section( 'sidebar_section', array( 'title' => 'Sidebar', 'priority' => 30, )); $wp_customize->add_section( 'links_section', array( 'title' => 'Links', 'priority' => 32, )); // Remove the Section Colors for the Sake of making Sense $wp_customize->remove_section( 'colors'); // Background needed to be moved to to the Background Section $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'background_color', array( 'label' => 'Background Color', 'section' => 'background_image', ))); // Change Site Title Color $wp_customize->add_setting( 'titlecolor_setting', array( 'default' => '#eee2d6', )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'titlecolor_control', array( 'label' => 'Site Title Color - #eee2d6', 'section' => 'title_tagline', 'settings' => 'titlecolor_setting', ))); // Change Tagline Color $wp_customize->add_setting( 'taglinecolor_setting', array( 'default' => '#066ba0', )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'taglinecolor_control', array( 'label' => 'Site Title Color - #066ba0', 'section' => 'title_tagline', 'settings' => 'taglinecolor_setting', ))); // Choose the Different Images for the Banner $wp_customize->add_setting('bannerimage_setting', array( 'default' => 'purple.png', 'capability' => 'edit_theme_options', 'type' => 'option', )); $wp_customize->add_control('themename_color_scheme', array( 'label' => 'Banner Background', 'priority' => 1, 'section' => 'header_section', 'settings' => 'bannerimage_setting', 'type' => 'radio', 'choices' => array( 'purple.png' => 'Purple (Default)', 'blue.png' => 'Blue', 'marble.png' => 'Marble', 'green.png' => 'Green', ), )); // Upload and Customization for the Banner and Header Options $wp_customize->add_setting('menu_setting', array( 'default' => 'standard', 'capability' => 'edit_theme_options', 'type' => 'option', )); $wp_customize->add_control('menu_control', array( 'label' => 'Menu Display Options', 'priority' => 6, 'section' => 'header_section', 'settings' => 'menu_setting', 'type' => 'radio', 'choices' => array( 'standard' => 'Standard (Default)', 'notitle' => 'No Title', 'bottom' => 'Moves Menu To Bottom', ), )); // Adjust the Space Between the Top of the Page and Content $wp_customize->add_setting( 'headerspacing_setting', array( 'default' => '35%', 'control' => 'select',)); $wp_customize->add_control( 'headerspacing_control', array( 'label' => 'Adjust the Spacing Between Top and Content', 'priority' => 90, 'section' => 'header_section', 'settings' => 'headerspacing_setting', 'type' => 'radio', 'choices' => array( '65' => '65%', '60' => '60%', '55' => '55%', '50' => '50%', '45' => '45%', '40' => '40%', '35' => '35% Default', '30' => '30%', '25' => '25%', '20' => '20%', '15' => '15%', '10' => '10%', '5' => '5%',), )); // Add the option to use the CSS3 property Background-size $wp_customize->add_setting( 'backgroundsize_setting', array( 'default' => 'auto', 'control' => 'select',)); $wp_customize->add_control( 'backgroundsize_control', array( 'label' => 'Background Size', 'section' => 'background_image', 'settings' => 'backgroundsize_setting', 'priority' => 10, 'type' => 'radio', 'choices' => array( 'auto' => 'Auto (Default)', 'contain' => 'Contain', 'cover' => 'Cover',), )); // Change the color of the Content Background $wp_customize->add_setting( 'backgroundcolor_setting', array( 'default' => '#b4b09d', 'control' => 'select',)); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'backgroundcolor_control', array( 'label' => 'Color of the Content Background', 'section' => 'content_section', 'settings' => 'backgroundcolor_setting', ))); // Change the opacity of the Content Background $wp_customize->add_setting( 'contentbackground_setting', array( 'default' => '.80', 'control' => 'select',)); $wp_customize->add_control( 'contentbackground_control', array( 'label' => 'Transparency of Content Background', 'section' => 'content_section', 'settings' => 'contentbackground_setting', 'type' => 'radio', 'choices' => array( '1' => '100', '.95' => '95', '.90' => '90', '.85' => '85', '.80' => '80 (Default)', '.75' => '75', '.70' => '70', '.65' => '65', '.60' => '60', '.55' => '55', '.50' => '50', '.45' => '45', '.40' => '40', '.35' => '35', '.30' => '30', '.25' => '25', '.20' => '20', '.15' => '15', '.10' => '10', '.05' => '5', '.00' => '0',), )); // Settings for the Previous & Next Post Link $wp_customize->add_setting( 'previousnext_setting', array( 'default' => 'both', 'control' => 'select',)); $wp_customize->add_control( 'previousnext_control', array( 'label' => 'Previous & Next Links After Content', 'section' => 'content_section', 'settings' => 'previousnext_setting', 'type' => 'radio', 'choices' => array( 'both' => 'Both Pages & Posts', 'posts' => 'Only Posts', 'pages' => 'Only Pages', 'neither' => 'Neither', ), )); // Change the color of the Sidebar Background $wp_customize->add_setting( 'sidebarcolor_setting', array( 'default' => '#000000', 'control' => 'select',)); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebarcolor_control', array( 'label' => 'Color of the Sidebar Background', 'section' => 'sidebar_section', 'settings' => 'sidebarcolor_setting', ))); // Change the opacity of the Sidebar Background $wp_customize->add_setting( 'sidebarbackground_setting', array( 'default' => '.50', 'control' => 'select',)); $wp_customize->add_control( 'sidebarbackground_control', array( 'label' => 'Transparency of Sidebar Background', 'section' => 'sidebar_section', 'settings' => 'sidebarbackground_setting', 'type' => 'radio', 'choices' => array( '1' => '100', '.95' => '95', '.90' => '90', '.85' => '85', '.75' => '75', '.70' => '70', '.65' => '65', '.60' => '60', '.55' => '55', '.50' => '50 (Default)', '.45' => '45', '.40' => '40', '.35' => '35', '.30' => '30', '.25' => '25', '.20' => '20', '.15' => '15', '.10' => '10', '.05' => '5', '.00' => '0',), )); } add_action('customize_register', 'adventure_customize'); // Preview CSS3 Property Background-size in Customizer function adventure_customizer_preview() { wp_enqueue_script('adventure-customizer', get_template_directory_uri() . '/js/customizer.js', array('jquery'), '1.3', true);} add_action( 'customize_controls_print_footer_scripts', 'adventure_customizer_preview', 10 ); // Inject the Customizer Choices into the Theme function adventure_inline_css() { // Convert Content from Hex to RGB $hex = str_replace("#", "", get_theme_mod('backgroundcolor_setting')); if(strlen($hex) == 3) { $r = hexdec(substr($hex,0,1).substr($hex,0,1)); $g = hexdec(substr($hex,1,1).substr($hex,1,1)); $b = hexdec(substr($hex,2,1).substr($hex,2,1)); } else { $r = hexdec(substr($hex,0,2)); $g = hexdec(substr($hex,2,2)); $b = hexdec(substr($hex,4,2)); } // Convert Sidebar from Hex to RGB $hexs = str_replace("#", "", get_theme_mod('sidebarcolor_setting')); if(strlen($hexs) == 3) { $rs = hexdec(substr($hexs,0,1).substr($hexs,0,1)); $gs = hexdec(substr($hexs,1,1).substr($hexs,1,1)); $bs = hexdec(substr($hexs,2,1).substr($hexs,2,1)); } else { $rs = hexdec(substr($hexs,0,2)); $gs = hexdec(substr($hexs,2,2)); $bs = hexdec(substr($hexs,4,2)); } echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo "\n"; if (get_option('favicon_setting') != '') { echo '' . "\n"; echo '' . "\n\n";} $options = get_theme_mod('typekit_setting'); if (get_theme_mod( 'typekit_setting' ) != 'For example mine is "jgu6yjc"') { echo '' . "\n"; echo '' . "\n"; echo '' . "\n\n";} } add_action('wp_head', 'adventure_inline_css'); // A safe way of adding javascripts to a WordPress generated page if (!function_exists('adventure_js')) { function adventure_js() { // JS at the bottom for fast page loading wp_enqueue_script('adventure-jquery-easing', get_template_directory_uri() . '/js/jquery.easing.js', array('jquery'), '1.3', true); wp_enqueue_script('adventure-menu-scrolling', get_template_directory_uri() . '/js/jquery.menu.scrolling.js', array('jquery'), '1', true); wp_enqueue_script('adventure-scripts', get_template_directory_uri() . '/js/jquery.fittext.js', array('jquery'), '1.0', true); wp_enqueue_script('adventure-fittext', get_template_directory_uri() . '/js/jquery.fittext.sizing.js', array('jquery'), '1', true); } } if (!is_admin()) add_action('wp_enqueue_scripts', 'adventure_js'); // Add some CSS so I can Style the Theme Options Page function adventure_admin_enqueue_scripts( $hook_suffix ) { wp_enqueue_style('adventure-theme-options', get_template_directory_uri() . '/theme-options.css', false, '1.0');} add_action('admin_print_styles-appearance_page_theme_options', 'adventure_admin_enqueue_scripts'); // Create the Theme Information page (Theme Options) function adventure_theme_options_do_page() { ?>