'ffffff', 'border' => 'e6e6e6', 'text' => '333333', 'link' => '428ce7', 'url' => '428ce7', ); break; default: $themecolors = array( 'bg' => '111111', 'border' => '515151', 'text' => 'eeeeee', 'link' => '428ce7', 'url' => '428ce7', ); break; } } //Set the content width based on the theme's design and stylesheet. if ( ! isset( $content_width ) ) $content_width = 950; /* pixels */ //Adjust the content width on non-singular pages. function modularity_set_content_width() { global $content_width; $options = get_option( 'modularity_theme_options' ); if ( ( isset( $options['sidebar'] ) && 1 == $options['sidebar'] ) && ! is_page_template( 'full-width-page.php' ) ) { $content_width = 590; } } add_action( 'template_redirect', 'modularity_set_content_width' ); function modularity_setup() { //Add support for post formats add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); // Add default posts and comments RSS feed links to head add_theme_support( 'automatic-feed-links' ); // Add post thumbnail theme support add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 150, 150, true ); // Add a new image size add_image_size( 'modularity-slideshow', 950, 425, true ); // Register nav menu locations register_nav_menus( array( 'primary' => __( 'Primary Navigation', 'text_domain' ), ) ); // Give Modularity a custom background add_theme_support( 'custom-background' ); load_theme_textdomain( 'modularity', get_template_directory() . '/languages' ); } add_action( 'after_setup_theme', 'modularity_setup' ); /** * Enqueue scripts and styles */ function modularity_scripts() { global $wp_styles; wp_enqueue_style( 'modularity', get_stylesheet_uri() ); wp_enqueue_style( 'modularity-screen', get_template_directory_uri() . '/library/styles/screen.css', array( 'modularity' ), false, 'screen, projection' ); wp_enqueue_style( 'modularity-print', get_template_directory_uri() . '/library/styles/print.css', array( 'modularity' ), false, 'print' ); wp_enqueue_style( 'modularity-ie', get_template_directory_uri() . '/library/styles/ie.css', array( 'modularity', 'modularity-screen' ) ); $wp_styles->add_data( 'modularity-ie', 'conditional', 'lte IE 8' ); wp_enqueue_style( 'modularity-ie-nav', get_template_directory_uri() . '/library/styles/ie-nav.css', array( 'modularity', 'modularity-screen' ) ); $wp_styles->add_data( 'modularity-ie-nav', 'conditional', 'lte IE 7' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); $options = modularity_get_options(); if ( is_home() && ! is_paged() && isset( $options['slideshow'] ) && $options['slideshow'] != 0) { wp_enqueue_style( 'modularity-flexslider-style', get_template_directory_uri() . '/js/flexslider/flexslider.css' ); wp_enqueue_script( 'modularity-flexslider-script', get_template_directory_uri() . '/js/flexslider/flexslider.js', array( 'jquery' ), '20130805', true ); } } add_action( 'wp_enqueue_scripts', 'modularity_scripts' ); // Get wp_page_menu() lookin' more like wp_nav_menu() function modularity_page_menu_args( $args ) { $args['show_home'] = true; $args['menu_class'] = 'main-nav'; return $args; } add_filter( 'wp_page_menu_args', 'modularity_page_menu_args' ); // Allow custom colors to clear the background image function modularity_custom_background_color() { if ( get_background_image() == '' && get_background_color() != '' ) { ?> 'dark', ); $options = get_option( 'modularity_theme_options', $defaults ); return $options; } // Register our color schemes and add them to the style queue function modularity_color_registrar() { $options = modularity_get_options(); $color_scheme = $options['color_scheme'] ?? ''; if ( ! empty( $color_scheme ) && $color_scheme != 'dark' ) { wp_register_style( $color_scheme, get_template_directory_uri() . '/' . $color_scheme . '.css', null, null ); wp_enqueue_style( $color_scheme ); } } add_action( 'wp_enqueue_scripts', 'modularity_color_registrar' ); // To use a sidebar, or not to use a sidebar, that is the question. This generates the appropriate class. function modularity_sidebar_class() { $options = get_option( 'modularity_theme_options' ); // If we're using a sidebar ... if ( isset( $options['sidebar'] ) && $options['sidebar'] == 1 ) { echo "15 colborder site-content"; } // If we're not using a sidebar ... else { echo "24 last"; } } function modularity_custom_header_setup() { add_theme_support( 'custom-header', apply_filters( 'modularity_custom_header_args', array( 'default-image' => '', 'default-text-color' => '', 'header-text' => false, 'width' => 950, 'height' => 200, 'admin-head-callback' => 'modularity_admin_header_style', ) ) ); } add_action( 'after_setup_theme', 'modularity_custom_header_setup' ); function modularity_admin_header_style() { ?> comment_type ) : case 'pingback' : case 'trackback' : ?>
  • id="li-comment-">
    comment_approved == '0' ) : ?>


    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    Theme Options', 'modularity' ); } else { $optional_description = ''; } if ( function_exists('register_sidebar') ) { register_sidebar(array( 'name' => 'Sidebar', 'id' => 'sidebar', 'description' => $optional_description, 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ', )); register_sidebar(array( 'name' => 'Footer 1', 'id' => 'footer-1', 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ', )); register_sidebar(array( 'name' => 'Footer 2', 'id' => 'footer-2', 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ', )); register_sidebar(array( 'name' => 'Footer 3', 'id' => 'footer-3', 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ' )); register_sidebar(array( 'name' => 'Footer 4', 'id' => 'footer-4', 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ' )); } /** * Adds custom classes to the array of body classes. */ function modularity_body_classes( $classes ) { $options = modularity_get_options(); $color_scheme = $options['color_scheme'] ?? ''; switch ( $color_scheme ) { case 'dark': $classes[] = 'color-dark'; break; default: $classes[] = 'color-light'; break; } // Adds a class of group-blog to blogs with more than 1 published author if ( is_multi_author() ) { $classes[] = 'group-blog'; } return $classes; } add_filter( 'body_class', 'modularity_body_classes' ); /** * Display twenty four posts in all archive template. * * Hooked onto the 'pre_get_posts' action, this changes the parameters * of the query before it gets any posts. * * @param WP_Query $query * @return WP_Query Possibly modified WP_query */ function modularity_home_posts( $query = false ) { if ( ! is_archive() || ! is_a( $query, 'WP_Query' ) || ! $query->is_main_query() ) return; $query->set( 'posts_per_page', 24 ); } add_action( 'pre_get_posts', 'modularity_home_posts' ); /** * Filters wp_title to print a neat tag based on what is being viewed. * * @since Modularity Lite 1.3 */ function modularity_wp_title( $title, $sep ) { global $page, $paged; if ( is_feed() ) return $title; // Add the blog name $title .= get_bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title .= " $sep $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) $title .= " $sep " . sprintf( __( 'Page %s', 'modularity' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'modularity_wp_title', 10, 2 ); /** * Load Jetpack compatibility file. * * @since Modularity Lite 1.4 */ if ( file_exists( get_template_directory() . '/inc/jetpack.php' ) ) require get_template_directory() . '/inc/jetpack.php';