esc_html__( 'Primary Menu', 'amy' ),
'footer' => esc_html__( 'Footer Menu', 'amy' ),
'mobile' => esc_html__( 'Mobile Menu', 'amy' ),
) );
// Switch default core markup for search form, comment form, and comments to output valid HTML5.
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
// Enable support for Post Formats.
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
) );
// Set up the WordPress core custom background feature.
// add_theme_support( 'custom-background', apply_filters( 'amy_custom_background_args', array(
// 'default-color' => 'f2f3f4',
// 'default-image' => '',
// ) ) );
// WooCommerce support
add_theme_support( 'woocommerce' );
// Styles for the visual editor to resemble the theme style.
add_editor_style( array( 'inc/css/editor-style.css', amy_fonts_url() ) );
}
endif; // amy_setup
add_action( 'after_setup_theme', 'amy_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function amy_content_width() {
$GLOBALS['content_width'] = apply_filters( 'amy_content_width', 728 );
}
add_action( 'after_setup_theme', 'amy_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function amy_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'amy' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar.', 'amy' ),
'before_widget' => '',
'before_title' => '
',
) );
// Content
register_sidebar( array(
'name' => esc_html__( 'Content Bottom', 'amy' ),
'id' => 'sidebar-content',
'description' => __( 'Appears at the bottom of the content on posts.', 'amy' ),
'before_widget' => '',
'before_title' => '',
) );
// Footer
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 1', 'amy' ),
'id' => 'footer-1',
'description' => __( 'Add widgets here to appear in your footer.', 'amy' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 2', 'amy' ),
'id' => 'footer-2',
'description' => __( 'Add widgets here to appear in your footer.', 'amy' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 3', 'amy' ),
'id' => 'footer-3',
'description' => __( 'Add widgets here to appear in your footer.', 'amy' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 4', 'amy' ),
'id' => 'footer-4',
'description' => __( 'Add widgets here to appear in your footer.', 'amy' ),
'before_widget' => '',
'before_title' => '',
) );
// Front Page
register_sidebar( array(
'name' => esc_html__( 'Front Page - Section 1', 'amy' ),
'id' => 'amy-front-page-1',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Front Page - Section 2 Left', 'amy' ),
'id' => 'amy-front-page-2-left',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Front Page - Section 2 Middle', 'amy' ),
'id' => 'amy-front-page-2-middle',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Front Page - Section 2 Right', 'amy' ),
'id' => 'amy-front-page-2-right',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Front Page - Section 3', 'amy' ),
'id' => 'amy-front-page-3',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Front Page - Section 4', 'amy' ),
'id' => 'amy-front-page-4',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
}
add_action( 'widgets_init', 'amy_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function amy_scripts() {
// Add custom fonts, used in the main stylesheet.
wp_enqueue_style( 'amy-fonts', amy_fonts_url(), array(), null );
wp_enqueue_style( 'amy-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'amy_scripts' );
if ( ! function_exists( 'amy_fonts_url' ) ) :
/**
* Register Google fonts.
*/
function amy_fonts_url() {
$fonts_url = '';
/* Translators: If there are characters in your language that are not
* supported by Open Sans, translate this to 'off'. Do not translate
* into your own language.
*/
$lato = _x( 'on', 'Open Sans font: on or off', 'amy' );
if ( 'off' !== $lato ) {
$font_families = array();
// $font_families[] = 'Open Sans:300,400,700,300italic,400italic,700italic';
$font_families[] = 'Montserrat';
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
/**
* WPshed Theme Extras Setting Defaults.
*/
function amy_wte_option_defaults () {
$defaults = get_option( 'wte' );
$defaults['themes_cpt'] = 0;
$defaults['plugins_cpt'] = 0;
update_option( 'wte', $defaults );
}
add_action( 'switch_theme', 'amy_wte_option_defaults' );
/**
* Default Portfolio Posts.
*/
function amy_portfolio_query( $query ){
if( ! is_admin()
&& $query->is_post_type_archive( 'portfolio' )
&& $query->is_main_query() ){
$query->set( 'posts_per_page', get_theme_mod( 'amy_portfolio_posts', '12' ) );
}
}
add_action( 'pre_get_posts', 'amy_portfolio_query' );
/**
* Framework Init.
*/
require get_template_directory() . '/inc/init.php';