__( 'Primary Menu', 'adamos' ), ) ); /** * Add support for post thumbnails */ add_theme_support('post-thumbnails'); add_image_size( 'frontpage-thumbnail', 460, 160, true); add_image_size( 100, 300, true); /** * Add support for the Aside Post Formats */ add_theme_support( 'post-formats', array( 'aside', ) ); } endif; // adamos_setup add_action( 'after_setup_theme', 'adamos_setup' ); /** * Setup the WordPress core custom background feature. * * Use add_theme_support to register support for WordPress 3.4+ * as well as provide backward compatibility for previous versions. * Use feature detection of wp_get_theme() which was introduced * in WordPress 3.4. * * Hooks into the after_setup_theme action. * * @since adamos 1.0 */ function adamos_register_custom_background() { $args = array( 'default-color' => 'EEE', ); $args = apply_filters( 'adamos_custom_background_args', $args ); if ( function_exists( 'wp_get_theme' ) ) { add_theme_support( 'custom-background', $args ); } else { define( 'BACKGROUND_COLOR', $args['default-color'] ); define( 'BACKGROUND_IMAGE', $args['default-image'] ); add_theme_support( 'custom-background', $args ); } } add_action( 'after_setup_theme', 'adamos_register_custom_background' ); /** * Register widgetized area and update sidebar with default widgets * * @since adamos 1.0 */ function adamos_widgets_init() { register_sidebar( array( 'name' => __( 'Primary Sidebar', 'adamos' ), 'id' => 'sidebar-1', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Secondary Sidebar', 'adamos' ), 'id' => 'sidebar-2', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar(array( 'name' => 'Left Footer Column', 'id' => 'left_column', 'description' => 'Widget area for footer left column', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Center Footer Column', 'id' => 'center_column', 'description' => 'Widget area for footer center column', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => 'Right Footer Column', 'id' => 'right_column', 'description' => 'Widget area for footer right column', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); } add_action( 'widgets_init', 'adamos_widgets_init' ); /** * Customizer additions */ require( get_template_directory() . '/inc/customizer.php' ); /** * Enqueue scripts and styles */ function adamos_scripts() { wp_enqueue_style( 'style', get_stylesheet_uri() ); if (!is_admin()) { wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true ); } 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', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } if (!is_admin()) { wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } } add_action( 'wp_enqueue_scripts', 'adamos_scripts' ); /** * Implement the Custom Header feature */ require( get_template_directory() . '/inc/custom-header.php' ); /** * Implement home slider */ function adamos_add_scripts() { if (!is_admin()) { wp_enqueue_script('flexslider', get_stylesheet_directory_uri('stylesheet_directory').'/js/jquery.flexslider-min.js', array('jquery')); wp_enqueue_script('flexslider-init', get_stylesheet_directory_uri('stylesheet_directory').'/js/flexslider-init.js', array('jquery', 'flexslider')); } } add_action('wp_enqueue_scripts', 'adamos_add_scripts'); function adamos_add_styles() { wp_enqueue_style('flexslider', get_stylesheet_directory_uri('stylesheet_directory').'/js/flexslider.css'); } add_action('wp_enqueue_scripts', 'adamos_add_styles'); add_theme_support('post-thumbnails'); add_image_size(100, 300, true); /** * Implement the Custom Logo feature */ function adamos_theme_customizer( $wp_customize ) { $wp_customize->add_section( 'adamos_logo_section' , array( 'title' => __( 'Logo', 'adamos' ), 'priority' => 30, 'description' => 'Upload a logo to replace the default site name and description in the header', ) ); $wp_customize->add_setting( 'adamos_logo' ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'adamos_logo', array( 'label' => __( 'Logo', 'adamos' ), 'section' => 'adamos_logo_section', 'settings' => 'adamos_logo', ) ) ); } add_action('customize_register', 'adamos_theme_customizer'); /** * Adds the individual section for featured text box top */ function adamos_customizer( $wp_customize ) { $wp_customize->add_section( 'featured_section_top', array( 'title' => 'Featured Text Area', 'description' => 'This is a settings section to change the homepage featured text area.', 'priority' => 150, ) ); $wp_customize->add_setting( 'featured_textbox', array( 'default' => 'Default featured text', 'sanitize_callback' => 'adamos_sanitize_text', ) ); $wp_customize->add_control( 'featured_textbox', array( 'label' => 'Featured text', 'section' => 'featured_section_top', 'type' => 'text', ) ); $wp_customize->add_setting( 'featured_textbox_text', array( 'default' => 'Default featured text', 'sanitize_callback' => 'adamos_sanitize_text', ) ); $wp_customize->add_control( 'featured_textbox_text', array( 'label' => 'Featured text', 'section' => 'featured_section_top', 'type' => 'text', ) ); } add_action( 'customize_register', 'adamos_customizer' ); /** * Adds the individual section for featured text box 1 */ function featured_text_one_customizer( $wp_customize ) { $wp_customize->add_section( 'featured_section_one', array( 'title' => 'Featured Text Box 1', 'description' => 'This is a settings section to change the homepage featured text area.', 'priority' => 155, ) ); $wp_customize->add_setting( 'featured_textbox_header_one', array( 'default' => 'Default featured text Header', 'sanitize_callback' => 'adamos_sanitize_text', ) ); $wp_customize->add_control( 'featured_textbox_header_one', array( 'label' => 'Featured Header text', 'section' => 'featured_section_one', 'type' => 'text', ) ); $wp_customize->add_setting( 'featured_textbox_text_one', array( 'default' => 'Default featured text', 'sanitize_callback' => 'adamos_sanitize_text', ) ); $wp_customize->add_control( 'featured_textbox_text_one', array( 'label' => 'Featured text', 'section' => 'featured_section_one', 'type' => 'text', ) ); } add_action( 'customize_register', 'featured_text_one_customizer' ); /** * Adds the individual section for featured text box 2 */ function featured_text_two_customizer( $wp_customize ) { $wp_customize->add_section( 'featured_section_two', array( 'title' => 'Featured Text Box 2', 'description' => 'This is a settings section to change the homepage featured text area.', 'priority' => 160, ) ); $wp_customize->add_setting( 'featured_textbox_header_two', array( 'default' => 'Default featured text Header', 'sanitize_callback' => 'adamos_sanitize_text', ) ); $wp_customize->add_control( 'featured_textbox_header_two', array( 'label' => 'Featured Header text', 'section' => 'featured_section_two', 'type' => 'text', ) ); $wp_customize->add_setting( 'featured_textbox_text_two', array( 'default' => 'Default featured text', 'sanitize_callback' => 'adamos_sanitize_text', ) ); $wp_customize->add_control( 'featured_textbox_text_two', array( 'label' => 'Featured text', 'section' => 'featured_section_two', 'type' => 'text', ) ); } add_action( 'customize_register', 'featured_text_two_customizer' ); /** * Adds the individual section for featured text box 3 */ function featured_text_three_customizer( $wp_customize ) { $wp_customize->add_section( 'featured_section_three', array( 'title' => 'Featured Text Box 3', 'description' => 'This is a settings section to change the homepage featured text area.', 'priority' => 165, ) ); $wp_customize->add_setting( 'featured_textbox_header_three', array( 'default' => 'Default featured text Header', 'sanitize_callback' => 'adamos_sanitize_text', ) ); $wp_customize->add_control( 'featured_textbox_header_three', array( 'label' => 'Featured Header text', 'section' => 'featured_section_three', 'type' => 'text', ) ); $wp_customize->add_setting( 'featured_textbox_text_three', array( 'default' => 'Default featured text', 'sanitize_callback' => 'adamos_sanitize_text', ) ); $wp_customize->add_control( 'featured_textbox_text_three', array( 'label' => 'Featured text', 'section' => 'featured_section_three', 'type' => 'text', ) ); } add_action( 'customize_register', 'featured_text_three_customizer' ); /** * Implement excerpt for homepage slider */ function get_slider_excerpt(){ $excerpt = get_the_content(); $excerpt = preg_replace(" (\[.*?\])",'',$excerpt); $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $excerpt = substr($excerpt, 0, 150); $excerpt = substr($excerpt, 0, strripos($excerpt, " ")); $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt)); return $excerpt; } /** * sanitize customizer text input */ function adamos_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } add_filter( 'wp_title', 'adamos_wp_title' ); /** * Implement excerpt for homepage thumbnails */ function content($limit) { $content = explode(' ', get_the_content(), $limit); if (count($content)>=$limit) { array_pop($content); $content = implode(" ",$content).'...'; } else { $content = implode(" ",$content); } $content = preg_replace('/\[.+\]/','', $content); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); return $content; } /** * Filters the page title appropriately depending on the current page * * This function is attached to the 'wp_title' fiilter hook. * * @uses get_bloginfo() * @uses is_home() * @uses is_front_page() */ function adamos_wp_title( $title ) { global $page, $paged; if ( is_feed() ) return $title; $site_description = get_bloginfo( 'description' ); $filtered_title = $title . get_bloginfo( 'name' ); $filtered_title .= ( ! empty( $site_description ) && ( is_home() || is_front_page() ) ) ? ' | ' . $site_description: ''; $filtered_title .= ( 2 <= $paged || 2 <= $page ) ? ' | ' . sprintf( __( 'Page %s', 'adamos' ), max( $paged, $page ) ) : ''; return $filtered_title; } add_action( 'admin_enqueue_scripts', 'custom_css_scripts' ); function custom_css_scripts( $hook ) { if ( 'appearance_page_custom_css_admin_page_content' == $hook ) { wp_enqueue_script( 'ace_code_highlighter_js', get_template_directory_uri() . '/ace/ace.js', '', '1.0.0', true ); wp_enqueue_script( 'ace_mode_js', get_template_directory_uri() . '/ace/mode-css.js', array( 'ace_code_highlighter_js' ), '1.0.0', true ); wp_enqueue_script( 'custom_css_js', get_template_directory_uri() . '/custom-css.js', array( 'jquery', 'ace_code_highlighter_js' ), '1.0.0', true ); } } add_action( 'admin_menu', 'custom_css_admin_page' ); function custom_css_admin_page() { add_theme_page( 'Custom CSS', __( 'Custom CSS' ), 'edit_theme_options', 'custom_css_admin_page_content', 'custom_css_admin_page_content' ); } add_action( 'admin_init', 'register_custom_css_setting' ); function register_custom_css_setting() { register_setting( 'custom_css', 'custom_css', 'custom_css_validation'); } function custom_css_admin_page_content() { // The default message that will appear $custom_css_default = __( '/* Welcome to the Custom CSS editor! Please add all your custom CSS here and avoid modifying the core theme files, since that\'ll make upgrading the theme problematic. Your custom CSS will be loaded after the theme\'s stylesheets, which means that your rules will take precedence. Just add your CSS here for what you want to change, you don\'t need to copy all the theme\'s style.css content. */' ); $custom_css = get_option( 'custom_css', $custom_css_default ); ?>

' . __( 'Custom CSS updated.' ) . '

'; ?>

"; echo '/* Custom CSS */' . "\n"; echo $custom_css . "\n"; echo ""; } }