__('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' ); // 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'); // 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_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' => 5, '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' => 'Content Background Color', 'section' => 'background_image', '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' => 'Content Background', 'section' => 'background_image', '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',), )); // 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' => 'Sidebar Background', 'section' => 'background_image', 'settings' => 'sidebarbackground_setting', 'type' => 'radio', 'choices' => array( '1' => '100', '.95' => '95', '.90' => '90', '.85' => '85', '.75' => '75', '.70' => '70', '.65' => '65', '.65' => '60', '.70' => '55', '.50' => '50 (Default)', '.65' => '40', '.65' => '35', '.60' => '30',), )); // Choose the Different Images for the Banner $wp_customize->add_section( 'bannerimage_section', array( 'title' => 'Banner Image', 'priority' => 2, )); $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' => 'Choose one of the choices below...', 'section' => 'bannerimage_section', 'settings' => 'bannerimage_setting', 'type' => 'radio', 'choices' => array( 'purple.png' => 'Purple (Default)', 'blue.png' => 'Blue', 'marble.png' => 'Marble', 'green.png' => 'Green', ), )); // 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', ))); } 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() { $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)); } echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo "\n";} add_action('wp_head', 'adventure_inline_css'); // 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() { ?>