apply_filters( 'default_background_color', '' ), 'default-image' => apply_filters( 'default_background_image', '' ), 'wp-head-callback' => 'cyberchimps_custom_background_cb' ); $defaults = apply_filters( 'cyberchimps_background_default_args', $defaults ); add_theme_support( 'custom-background', $defaults ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => __( 'Primary Menu', 'cyberchimps_core' ), ) ); //set up defaults $option_defaults = cyberchimps_get_default_values(); if ( !get_option( 'cyberchimps_options' ) && isset( $_GET['activated'] ) ) { update_option( 'cyberchimps_options', $option_defaults ); } //if not then set up defaults for this theme elseif ( get_option( 'cyberchimps_options' ) && isset( $_GET['activated'] ) ) { $options = get_option( 'cyberchimps_options' ); $options['header_section_order'] = $option_defaults['header_section_order']; $options['theme_backgrounds'] = $option_defaults['theme_backgrounds']; update_option( 'cyberchimps_options', $options ); } } endif; // cyberchimps_core_setup_theme add_action( 'after_setup_theme', 'cyberchimps_core_setup_theme' ); function cyberchimps_custom_background_cb() { $style = ""; // $background is the saved custom image, or the default image. $background = get_background_image(); // $color is the saved custom color. // A default has to be specified in style.css. It will not be printed here. $color = esc_html(get_theme_mod( 'background_color' )); // CyberChimps background image $cc_background = esc_html(get_theme_mod( 'cyberchimps_background' )); if ( !$background && !$color && !$cc_background ) { return; } if ( $background ) { $image = " background-image: url('$background');"; $repeat = esc_html(get_theme_mod( 'background_repeat', 'repeat' )); if ( !in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) ) { $repeat = 'repeat'; } $repeat = " background-repeat: $repeat;"; $position = esc_html(get_theme_mod( 'background_position_x', 'left' )); if ( !in_array( $position, array( 'center', 'right', 'left' ) ) ) { $position = 'left'; } $position = " background-position: top $position;"; $attachment = esc_html(get_theme_mod( 'background_attachment', 'scroll' )); if ( !in_array( $attachment, array( 'fixed', 'scroll' ) ) ) { $attachment = 'scroll'; } $attachment = " background-attachment: $attachment;"; $style = $image . $repeat . $position . $attachment; } else if( $cc_background != 'none' && !empty( $cc_background ) ) { $img_url = get_template_directory_uri() . '/cyberchimps/lib/images/backgrounds/' . $cc_background . '.jpg'; $style = "background-image: url( '$img_url' );"; } else if( $color ) { $style = "background-color: #$color;"; $style .= "background-image: none;"; } ?> __( 'Sidebar Left', 'cyberchimps_core' ), 'id' => 'sidebar-left', 'before_widget' => apply_filters( 'cyberchimps_sidebar_before_widget', '' ), 'before_title' => apply_filters( 'cyberchimps_sidebar_before_widget_title', '

' ), 'after_title' => apply_filters( 'cyberchimps_sidebar_after_widget_title', '

' ) ) ); } register_sidebar( array( 'name' => __( 'Sidebar Right', 'cyberchimps_core' ), 'id' => 'sidebar-right', 'before_widget' => apply_filters( 'cyberchimps_sidebar_before_widget', '' ), 'before_title' => apply_filters( 'cyberchimps_sidebar_before_widget_title', '

' ), 'after_title' => apply_filters( 'cyberchimps_sidebar_after_widget_title', '

' ) ) ); register_sidebar( array( 'name' => __( 'Footer Widgets', 'cyberchimps_core' ), 'id' => 'cyberchimps-footer-widgets', 'before_widget' => apply_filters( 'cyberchimps_footer_before_widget', '' ), 'before_title' => apply_filters( 'cyberchimps_footer_before_widget_title', '

' ), 'after_title' => apply_filters( 'cyberchimps_footer_after_widget_title', '

' ) ) ); } add_action( 'widgets_init', 'cyberchimps_widgets_init' ); function cyberchimps_load_hooks() { // Set the path to hooks directory. $hooks_path = get_template_directory() . "/cyberchimps/hooks/"; require_once( $hooks_path . 'wp-head-hooks.php' ); require_once( $hooks_path . 'header-hooks.php' ); require_once( $hooks_path . 'blog-hooks.php' ); require_once( $hooks_path . 'page-hooks.php' ); require_once( $hooks_path . 'footer-hooks.php' ); } add_action( 'after_setup_theme', 'cyberchimps_load_hooks' ); //after install redirect user to options page if it's a pro theme. function cyberchimps_pro_welcome_notice() { global $pagenow; if ( is_admin() && isset( $_GET['activated'] ) && $pagenow == "themes.php" ) { if ( 'pro' == cyberchimps_theme_check() ) { wp_redirect( 'themes.php?page=cyberchimps-theme-options' ); } } } add_action( 'after_setup_theme', 'cyberchimps_pro_welcome_notice' );