urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); // Create Fonts URL $fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' ); endif; return apply_filters( 'anderson_google_fonts_url', $fonts_url ); } // Setup Function: Registers support for various WordPress features add_action( 'after_setup_theme', 'anderson_setup' ); if ( ! function_exists( 'anderson_setup' ) ): function anderson_setup() { // Set Content Width global $content_width; if ( ! isset( $content_width ) ) $content_width = 860; // init Localization load_theme_textdomain('anderson-lite', get_template_directory() . '/languages' ); // Add Theme Support add_theme_support('post-thumbnails'); add_theme_support('automatic-feed-links'); add_editor_style(); // Add Custom Background add_theme_support('custom-background', array('default-color' => '777777')); // Add Custom Header add_theme_support('custom-header', array( 'header-text' => false, 'width' => 1300, 'height' => 250, 'flex-height' => true)); // Add theme support for Jetpack Featured Content add_theme_support( 'featured-content', array( 'featured_content_filter' => 'anderson_get_featured_content', 'max_posts' => 4 ) ); // Add Theme Support for Anderson Pro Plugin add_theme_support( 'anderson-pro' ); // Register Navigation Menus register_nav_menu( 'primary', __('Main Navigation', 'anderson-lite') ); register_nav_menu( 'secondary', __('Top Navigation', 'anderson-lite') ); register_nav_menu( 'footer', __('Footer Navigation', 'anderson-lite') ); // Register Social Icons Menu register_nav_menu( 'social', __('Social Icons', 'anderson-lite') ); } endif; // Add custom Image Sizes add_action( 'after_setup_theme', 'anderson_add_image_sizes' ); if ( ! function_exists( 'anderson_add_image_sizes' ) ): function anderson_add_image_sizes() { // Add Post Thumbnail Size add_image_size( 'post-thumbnail', 275, 275, true); // Add Custom Header Image Size add_image_size( 'custom-header-image', 1300, 250, true); // Add Category Post Widget image sizes add_image_size( 'category-posts-widget-small', 95, 95, true); add_image_size( 'category-posts-widget-big', 460, 325, true); // Add Slider Image Size add_image_size( 'slider-image', 840, 440, true); } endif; // Register Sidebars add_action( 'widgets_init', 'anderson_register_sidebars' ); if ( ! function_exists( 'anderson_register_sidebars' ) ): function anderson_register_sidebars() { // Register Sidebar register_sidebar( array( 'name' => __( 'Sidebar', 'anderson-lite' ), 'id' => 'sidebar', 'description' => __( 'Appears on posts and pages except Magazine Homepage and Fullwidth template.', 'anderson-lite' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // Register Magazine Homepage Widgets register_sidebar( array( 'name' => __( 'Magazine Homepage', 'anderson-lite' ), 'id' => 'magazine-homepage', 'description' => __( 'Appears on "Magazine Homepage" page template only. You can use the Category Posts widgets here.', 'anderson-lite' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } endif; /*==================================== THEME FUNCTIONS ====================================*/ // Creates a better title element text for output in the head section add_filter( 'wp_title', 'anderson_wp_title', 10, 2 ); function anderson_wp_title( $title, $sep = '' ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'anderson-lite' ), max( $paged, $page ) ); return $title; } // Add Default Menu Fallback Function function anderson_default_menu() { echo ''; } // Get Featured Posts function anderson_get_featured_content() { return apply_filters( 'anderson_get_featured_content', false ); } // Check if featured posts exists function anderson_has_featured_content() { return ! is_paged() && (bool) anderson_get_featured_content(); } // Change Excerpt Length add_filter('excerpt_length', 'anderson_excerpt_length'); function anderson_excerpt_length($length) { return 60; } // Change Excerpt More add_filter('excerpt_more', 'anderson_excerpt_more'); function anderson_excerpt_more($more) { // Get Theme Options from Database $theme_options = anderson_theme_options(); // Return Excerpt Text if ( isset($theme_options['excerpt_text']) and $theme_options['excerpt_text'] == true ) : return ' [...]'; else : return ''; endif; } // Change Excerpt Length for Featured Content add_filter('excerpt_length', 'anderson_excerpt_length'); function anderson_slideshow_excerpt_length($length) { return 28; } // Change Excerpt Length for Featured Content add_filter('excerpt_length', 'anderson_excerpt_length'); function anderson_category_posts_widgets_excerpt_length($length) { return 12; } // Custom Template for comments and pingbacks. if ( ! function_exists( 'anderson_list_comments' ) ): function anderson_list_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; if( $comment->comment_type == 'pingback' or $comment->comment_type == 'trackback' ) : ?>
  • id="comment-">

    ', '' ); ?>

  • id="comment-">
    %s', 'anderson-lite'), get_comment_author_link()) ?>
    comment_approved == '0') : ?>

    $depth, 'max_depth' => $args['max_depth']))) ?>