get_template_directory_uri() . '/images/sam.jpg', 'height' => 600, 'uploads' => true, 'header_text' => true, 'default-text-color' => 'c9bab0', 'wp-head-callback' => 'blackgold_style_header', ); $custom_background = array( 'default-color' => 'fcfcfc', ); // Since V4.1, WordPress uses add_theme_support for supporting title tags add_theme_support( "title-tag" ); // Since V3.1, WordPress uses add_theme_support for custom headers add_theme_support( 'custom-header', $header_defaults ); // Since V3.4, WordPress uses add_theme_support for custom backgrounds add_theme_support( 'custom-background', $custom_background ); // Since V2.9, WordPress uses add_theme_support for post thumbnails add_theme_support( 'post-thumbnails' ); // Since V3.0, WordPress uses add_theme_support for automatic feed links add_theme_support( 'automatic-feed-links' ); // Allow for partial refreshes of widgets in sidebars add_theme_support( 'customize-selective-refresh-widgets' ); load_theme_textdomain( 'black-gold', get_template_directory() . '/languages/' ); } add_action( 'after_setup_theme', 'blackgold_setup_theme' ); /* * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * THEME CUSTOMIZER * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ add_action( 'customize_register', 'blackgold_customize_register' ); /* * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * CALLBACKS * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ /* * Callback function for updating header styles * Responsible for styling the applied header image * and selected header text color. */ function blackgold_style_header() { // get users selected text color $text_color = get_header_textcolor(); ?> get_control( $setting->id ); $choice = intval( $input ); if ( $choice >= 0 && $choice <= sizeof( $control->choices ) ) { return $choice; } else { return 0; } } /* * Ensure that the value received from our checkboxes * correspond to a suitable value. */ function blackgold_sanitize_option( $input ) { if( $input == 'true' ) return 1; else return 0; } /* * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * MENUS * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * * Registers custom Navigation Menus for use in the custom menu editor, * allowing administration users to create custom menus. */ function blackgold_register_menus() { register_nav_menu( 'main_menu', __( 'Main Menu', 'black-gold' ) ); } add_action( 'init', 'blackgold_register_menus' ); /* * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * WIDGETS * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * * Registers sidebars for use in the custom widgets editor, * allowing administration users to add & remove widgets from * each respective sidebar. * */ function blackgold_register_widgets() { // Register the Home Sidebar register_sidebar( array( 'name' => __( 'Home Sidebar', 'black-gold' ), 'id' => 'home_sidebar', 'description' => __( 'The sidebar showcased on the main area of your screen', 'black-gold'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // Register the Footer Sidebar register_sidebar( array( 'name' => __( 'Footer Sidebar', 'black-gold' ), 'id' => 'footer_sidebar', 'description' => __( 'The sidebar positioned in the footer at the bottom of the screen', 'black-gold' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'blackgold_register_widgets' ); /* * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * EDITOR STYLE * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * * Adds the editor style for control over the appearance * of your content in the TinyMCE visual editor. * */ function blackgold_add_editor_style() { add_editor_style( get_template_directory_uri() . '/css/editor-style.css' ); } add_action( 'admin_init', 'blackgold_add_editor_style' ); /* * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * RETRIEVE CSS & JS * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * * Enqueue external scripts and styles to prevent plugin * conflicts. Scripts and styles are enqueued using the wp_enqueue_scripts * action hook * */ function blackgold_load_css() { /* Third Party CSS */ // >>> Bootstrap CSS wp_enqueue_style( 'bootstrap_cs', get_template_directory_uri() . '/css/bootstrap.min.css' ); // >>> Font-Awesome CSS wp_enqueue_style( 'fontawesome_cs', get_template_directory_uri() . '/css/font-awesome.css' ); // >>> Custom CSS wp_enqueue_style( 'main_css', get_stylesheet_uri() ); } function blackgold_load_js() { /* Third Party JS */ // >>> Bootstrap wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), '', true ); // >>> HTML 5 Shiv wp_enqueue_script( 'html5_js', get_template_directory_uri() . '/js/html5.js' ); wp_script_add_data( 'html5_js', 'conditional', 'lt IE 9' ); // >> Custom JS wp_enqueue_script( 'main_js', get_template_directory_uri() . '/js/main.js', array( 'jquery' ), '', true ); } function blackgold_load_scripts() { blackgold_load_css(); blackgold_load_js(); } add_action( 'wp_enqueue_scripts', 'blackgold_load_scripts' ); /* * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * CONTENT WIDTH * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * * Sets the maximum allowed width for any of the content * improving plugin integration. * */ if ( ! isset( $content_width ) ) $content_width = 960; /* * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * FILTERS * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ /* * Alters the default form elements displayed * in the comments section by modiyfing the existing markup * defined by WordPress. */ function blackgold_comment_form_defaults( $fields ) { $submit_button_value = __( 'Post Comment', 'black-gold' ); // Add the Bootstrap Form Control class $fields['comment_field'] = ''; // Add a custom class to the submit button $fields['submit_button'] = sprintf( '', $submit_button_value ); return $fields; } add_filter( 'comment_form_defaults', 'blackgold_comment_form_defaults' ); /* * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- * CUSTOM FUNCTIONS * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ /* * Applies the respective classes to available * pages, as well as the currently selected * page item for wp_link_pages. */ function blackgold_wp_link_pages( ) { $defaults = array( 'before' => '', 'pagelink' => '%', 'separator' => '', 'echo' => 0, ); $link_pages = wp_link_pages( $defaults ); $link_pages = str_replace(')|(?:> ))(\d+)(<)/', "$1$2$3", $link_pages); echo $link_pages; }