tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* 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 featured images
add_theme_support( 'post-thumbnails' );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'Framer_custom_background_args', array(
'default-color' => '#fff',
'default-image' => '',
'panel' => 'Framer_colors',
) ) );
add_image_size( 'Framer-full', 1060, 700, true );
add_image_size( 'Framer-blog-thumb', 690, 542, true );
}
endif;
add_action( 'after_setup_theme', 'Framer_setup' );
// WooCommerce Support
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'Framer' ),
) );
function Framer_set_sample_content()
{
// Add default items to primary menu
$primary_menu_items = wp_get_nav_menu_items( 'primary' );
if ( empty( $primary_menu_items ) ) {
$name = 'primary';
$menu_id = wp_create_nav_menu( $name );
$menu = get_term_by( 'name', $name, 'nav_menu' );
wp_update_nav_menu_item( $menu->term_id, 0, array(
'menu-item-title' => __( 'Home', 'Framer' ),
'menu-item-url' => home_url( '/' ),
'menu-item-status' => 'publish' )
);
wp_update_nav_menu_item( $menu->term_id, 0, array(
'menu-item-title' => __( 'Pricing', 'Framer' ),
'menu-item-url' => home_url( '/' ),
'menu-item-status' => 'publish' )
);
wp_update_nav_menu_item( $menu->term_id, 0, array(
'menu-item-title' => __( 'Blog', 'Framer' ),
'menu-item-url' => home_url( '/' ),
'menu-item-status' => 'publish' )
);
wp_update_nav_menu_item( $menu->term_id, 0, array(
'menu-item-title' => __( 'Contact', 'Framer' ),
'menu-item-url' => home_url( '/' ),
'menu-item-status' => 'publish' )
);
wp_update_nav_menu_item( $menu->term_id, 0, array(
'menu-item-title' => __( 'Members', 'Framer' ),
'menu-item-url' => home_url( '/' ),
'menu-item-status' => 'publish' )
);
wp_update_nav_menu_item( $menu->term_id, 0, array(
'menu-item-title' => __( 'Sign up', 'Framer' ),
'menu-item-url' => home_url( '/' ),
'menu-item-status' => 'publish' )
);
$locations = get_theme_mod( 'nav_menu_locations' );
$locations['primary'] = $menu->term_id;
set_theme_mod( 'nav_menu_locations', $locations );
}
// set sample content - text, images, titles, team members
if ( !get_theme_mod( 'Framer_content_set', false ) ) {
// set up default widgets
$active_sidebars = get_option( 'sidebars_widgets' );
$search_widget = get_option( 'widget_search' );
$search_widget[1] = array( 'title' => __( 'Search', 'Framer' ) );
$admin = get_user_by( 'email', get_option( 'admin_email' ) );
$userId = $admin->ID;
$author_box_widget = get_option( 'widget_Framer-author-box-widget' );
$author_box_widget[1] = array(
'title-' . $userId => __( 'AUTHOR PROFILE', 'Framer' ),
'textbox-' . $userId => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean dapibus erat eget rhoncus facilisis. Duis et lacus ut tellus fermentum ultricies quis sit amet mauris. Nullam molestie, mauris ac ultrices tincidunt, sapien turpis rhoncus tellus, sed sagittis dui felis molestie risus.',
'image_url-' . $userId => get_template_directory_uri() . '/images/author_profile.png',
'social_twitter-' . $userId => 'http://twitter.com',
'social_facebook-' . $userId => 'https://facebook.com',
'social_linkedin-' . $userId => 'https://linkedin.com',
'social_pinterest-' . $userId => 'https://pinterest.com',
'social_dribbble-' . $userId => 'https://dribbble.com',
'social_drupal-' . $userId => 'https://drupal.com',
'social_wordpress-' . $userId => 'https://wordpress.com',
'social_y-combinator-' . $userId => 'https://ycombinator.com',
'social_gplus-' . $userId => 'https://plus.google.com',
);
$popular_recent_posts_widget = get_option( 'widget_Framer-recent-popular-posts-widget' );
$popular_recent_posts_widget[1] = array( 'title-popular' => 'Popular', 'title-recent' => 'Recent', 'timeFramer' => 'week', 'limit' => 3 );
$text_widget = get_option( 'widget_text' );
$text_widget[1] = array( 'title' => __( 'Text Widget', 'Framer' ), 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam aliquam, risus non vehicula vestibulum, purus tortor tempor mauris, consectetur semper tortor dolor sed mauris. Morbi nunc ipsum' );
$text_widget[2] = array( 'title' => __( 'Text Widget', 'Framer' ), 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam aliquam, risus non vehicula vestibulum, purus tortor tempor mauris, consectetur semper tortor dolor sed mauris. Morbi nunc ipsum' );
$text_widget[3] = array( 'title' => __( 'Text Widget', 'Framer' ), 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam aliquam, risus non vehicula vestibulum, purus tortor tempor mauris, consectetur semper tortor dolor sed mauris. Morbi nunc ipsum' );
$text_widget[4] = array( 'title' => __( 'Text Widget', 'Framer' ), 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam aliquam, risus non vehicula vestibulum, purus tortor tempor mauris, consectetur semper tortor dolor sed mauris. Morbi nunc ipsum' );
$active_sidebars['Framer-footer'] = array( 'text-1', 'text-2', 'text-3', 'text-4' );
update_option( 'widget_Framer-author-box-widget', $author_box_widget );
update_option( 'widget_Framer-recent-popular-posts-widget', $popular_recent_posts_widget );
update_option( 'sidebars_widgets', $active_sidebars );
$active_sidebars['sidebar-1'] = array( 'Framer-author-box-widget-1', 'text-4', 'search-1', 'Framer-recent-popular-posts-widget-1' );
update_option( 'widget_search', $search_widget );
update_option( 'widget_text', $text_widget );
update_option( 'sidebars_widgets', $active_sidebars );
$feature_widget = get_option( 'widget_Framer-feature-widget' );
$feature_widget[1] = array(
'title' => __( 'Modern Design', 'Framer' ),
'textbox' => 'Framer has a nice homepage with a hero header area so you can write some into text with call to action buttons and links to your social media profiles.',
'url' => get_home_url(),
'icon' => 'fa-desktop',
);
$feature_widget[2] = array(
'title' => __( 'eCommerce Ready', 'Framer' ),
'textbox' => 'Use Framer with the WooCommerce plugin and you can create your own online store to sell digital or tangible products with no fuss.',
'url' => get_home_url(),
'icon' => ' fa-shopping-basket',
);
$feature_widget[3] = array(
'title' => __( 'Live Customize', 'Framer' ),
'textbox' => 'Using the built-in WordPress Customizer you can change colors, fonts, text, buttons and upload your own logo for the footer and the header area.',
'url' => get_home_url(),
'icon' => 'fa-gears',
);
$feature_widget[4] = array(
'title' => __( 'Coded With Care', 'Framer' ),
'textbox' => 'We have coded the Framer theme to be fast loading, with no bloated extras and it complies with all the latest WordPress theme requirements.',
'url' => get_home_url(),
'icon' => 'fa-file-code-o',
);
$active_sidebars['Framer-features'] = array( 'Framer-feature-widget-1', 'Framer-feature-widget-2', 'Framer-feature-widget-3', 'Framer-feature-widget-4' );
update_option( 'widget_Framer-feature-widget', $feature_widget );
update_option( 'sidebars_widgets', $active_sidebars );
// set customizer options
set_theme_mod( 'Framer_header_logo_image', get_template_directory_uri() . '/images/logo.png' );
set_theme_mod( 'Framer_header_logo_show', 'logo' );
set_theme_mod( 'Framer_footer_logo_image', get_template_directory_uri() . '/images/logo-footer.png' );
set_theme_mod( 'Framer_footer_logo_show', 'yes' );
set_theme_mod( 'Framer_header_logo_text', get_bloginfo( 'name' ) );
set_theme_mod( 'Framer_hero_show', 'yes' );
set_theme_mod( 'Framer_hero_bg_image', get_template_directory_uri() . '/images/header.jpg' );
set_theme_mod( 'Framer_hero_title', 'I’m a Designer.' );
set_theme_mod( 'Framer_hero_text', 'Framer is a light-weight and simple WordPress portfolio theme for showing off your latest photos and designs. It works with the Free WooCommerce plugin to create your own eCommerce site. It is super simple to setup with some nice options controlled using the Live Customizer.' );
set_theme_mod( 'Framer_hero_overlay_enabled', 'yes' );
set_theme_mod( 'Framer_hero_overlay_opacity', 80 );
set_theme_mod( 'Framer_header_social_twitter', 'http://twitter.com' );
set_theme_mod( 'Framer_header_social_facebook', 'https://facebook.com' );
set_theme_mod( 'Framer_header_social_pinterest', 'https://pinterest.com' );
set_theme_mod( 'Framer_header_social_linkedin', 'https://linkedin.com' );
set_theme_mod( 'Framer_header_social_gplus', 'https://plus.google.com' );
set_theme_mod( 'Framer_header_social_behance', 'http://behance.net' );
set_theme_mod( 'Framer_header_social_dribbble', 'http://dribbble.com' );
set_theme_mod( 'Framer_header_social_flickr', 'http://flickr.com' );
set_theme_mod( 'Framer_header_social_500px', 'http://500px.com' );
set_theme_mod( 'Framer_header_social_reddit', 'http://reddit.com' );
set_theme_mod( 'Framer_header_social_wordpress', 'http://wordpress.com' );
set_theme_mod( 'Framer_header_social_youtube', 'http://youtube.com' );
set_theme_mod( 'Framer_hero_button1_text', __( 'About us', 'Framer' ) );
set_theme_mod( 'Framer_hero_button2_text', __( 'Contact us', 'Framer' ) );
set_theme_mod( 'Framer_content_set', true );
}
}
add_action( 'after_switch_theme', 'Framer_set_sample_content', 100 );
// Style the Tag Cloud
function Framer_tag_cloud_widget( $args )
{
$args['largest'] = 12; //largest tag
$args['smallest'] = 12; //smallest tag
$args['unit'] = 'px'; //tag font unit
$args['number'] = '8'; //number of tags
return $args;
}
add_filter( 'widget_tag_cloud_args', 'Framer_tag_cloud_widget' );
// add custom class to tags
function Framer_add_class_the_tags( $html )
{
$html = str_replace( ' __( 'Footer', 'Framer' ),
'id' => 'framer-footer',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'Framer_widgets_init' );
// Load Roboto Font
function Framer_fonts_url()
{
$fonts_url = '';
$font_families = array();
// default fonts - Roboto and Arimo
$roboto = _x( 'on', 'Montserrat font: on or off', 'Framer' );
$arimo = _x( 'on', 'Arimo font: on or off', 'Framer' );
$heading_font_family = get_theme_mod( 'Framer_google_fonts_heading_font', null );
$body_font_family = get_theme_mod( 'Framer_google_fonts_body_font', null );
if ( 'off' !== $roboto ) {
$font_families[] = 'Montserrat, sans-serif;:400,700';
}
if ( 'off' !== $arimo ) {
$font_families[] = 'Arimo:400,400italic,700,700italic';
}
if ( !empty( $heading_font_family ) && $heading_font_family !== 'none' ) {
$heading_font = _x( 'on', $heading_font_family . ' font: on or off', 'Framer' );
if ( 'off' !== $heading_font ) {
$font_families[] = $heading_font_family;
}
}
if ( !empty( $body_font_family ) && $body_font_family !== 'none' && $body_font_family !== $heading_font_family ) {
$body_font = _x( 'on', $body_font_family . ' font: on or off', 'Framer' );
if ( 'off' !== $body_font ) {
$font_families[] = $body_font_family;
}
}
// if both body and heading fonts are set in customizer,
// don't include default Roboto and Arimo fonts
if ( count( $font_families ) === 4 ) {
array_slice( $font_families, 2 );
}
if ( !empty( $font_families ) ) {
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
}
return $fonts_url;
}
/**
* Enqueue scripts and styles.
*/
function Framer_scripts()
{
wp_enqueue_style( 'Framer-style', get_stylesheet_uri() );
wp_enqueue_style( 'Framer-font-awesome', get_template_directory_uri() . '/inc/css/font-awesome.min.css' );
wp_enqueue_style( 'Framer-fonts', Framer_fonts_url(), array(), null );
wp_enqueue_script( 'Framer-footer-scripts', get_template_directory_uri() . '/inc/js/script.js', array( 'jquery' ), '20151107', true );
wp_enqueue_script( 'Framer-nanobar', get_template_directory_uri() . '/inc/js/nanobar.min.js', array( 'jquery' ), '20151107' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'Framer_scripts' );
/**
* Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis) and sets character length to 35
*/
/**
* Filter the except length to 20 characters.
*
* @param int $length Excerpt length.
* @return int (Maybe) modified excerpt length.
*/
function Framer_custom_excerpt_length( $length )
{
return 20;
}
add_filter( 'excerpt_length', 'Framer_custom_excerpt_length', 999 );
/**
* Filter the excerpt "read more" string.
*
* @param string $more "Read more" excerpt string.
* @return string (Maybe) modified "read more" excerpt string.
*/
function Framer_excerpt_more( $more )
{
return '';
}
add_filter( 'excerpt_more', 'Framer_excerpt_more' );
function Framer_esc_html( $text )
{
return strip_tags( $text, '
' );
}
function Framer_pagination( $wp_query_object = null )
{
global $wp_query;
$query_object = !empty( $wp_query_object ) ? $wp_query_object : $wp_query;
if ( !is_page() && $query_object->max_num_pages < 2 ) {
return;
}
$big = 999999999; // need an unlikely integer
echo '';
}
require get_template_directory() . '/inc/template-tags.php';
require get_template_directory() . '/inc/themesetup.php';
require get_template_directory() . '/inc/customizer.php';