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( 'shapon_google_fonts_url', $fonts_url ); } // Setup Function: Registers support for various WordPress features add_action( 'after_setup_theme', 'shapon_setup' ); if ( ! function_exists( 'shapon_setup' ) ): function shapon_setup() { // Set Content Width global $content_width; if ( ! isset( $content_width ) ) $content_width = 860; // init Localization load_theme_textdomain('shapon-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' => 'e5e5e5', 'default-image' => get_template_directory_uri() . '/images/background.png')); // Add Custom Header add_theme_support('custom-header', array( 'header-text' => false, 'width' => 1340, 'height' => 250, 'flex-height' => true)); // Add theme support for Jetpack Featured Content add_theme_support( 'featured-content', array( 'featured_content_filter' => 'shapon_get_featured_content', 'max_posts' => 20 ) ); // Register Navigation Menus register_nav_menu( 'primary', __('Main Navigation', 'shapon-lite') ); register_nav_menu( 'secondary', __('Top Navigation', 'shapon-lite') ); register_nav_menu( 'footer', __('Footer Navigation', 'shapon-lite') ); // Register Social Icons Menu register_nav_menu( 'social', __('Social Icons', 'shapon-lite') ); } endif; // Add custom Image Sizes add_action( 'after_setup_theme', 'shapon_add_image_sizes' ); if ( ! function_exists( 'shapon_add_image_sizes' ) ): function shapon_add_image_sizes() { // Add Custom Header Image Size add_image_size( 'custom_header_image', 1340, 250, true); // Add Featured Image Size add_image_size( 'featured_image', 300, 200, true); // Add Slider Image Size add_image_size( 'slider_image', 880, 350, true); // Add Frontpage Thumbnail Sizes add_image_size( 'category_posts_wide_thumb', 600, 240, true); add_image_size( 'category_posts_small_thumb', 90, 90, true); // Add Widget Post Thumbnail Size add_image_size( 'widget_post_thumb', 75, 75, true); } endif; // Register Sidebars add_action( 'widgets_init', 'shapon_register_sidebars' ); if ( ! function_exists( 'shapon_register_sidebars' ) ): function shapon_register_sidebars() { // Register Sidebars register_sidebar( array( 'name' => __( 'Sidebar', 'shapon-lite' ), 'id' => 'sidebar', 'description' => __( 'Appears on posts and pages except front page and fullwidth template.', 'shapon-lite' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Magazine Front Page', 'shapon-lite' ), 'id' => 'frontpage-magazine', 'description' => __( 'Appears on Magazine Front Page page template only. You can use the Category Posts widgets here.', 'shapon-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', 'shapon_wp_title', 10, 2 ); function shapon_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', 'shapon-lite' ), max( $paged, $page ) ); return $title; } // Add Default Menu Fallback Function function shapon_default_menu() { echo ''; } // Get Featured Posts function shapon_get_featured_content() { return apply_filters( 'shapon_get_featured_content', false ); } // Change Excerpt Length add_filter('excerpt_length', 'shapon_excerpt_length'); function shapon_excerpt_length($length) { return 60; } // Slideshow Excerpt Length function shapon_slideshow_excerpt_length($length) { return 15; } // Frontpage Category Excerpt Length function shapon_frontpage_category_excerpt_length($length) { return 25; } // Change Excerpt More add_filter('excerpt_more', 'shapon_excerpt_more'); function shapon_excerpt_more($more) { // Get Theme Options from Database $theme_options = shapon_theme_options(); // Return Excerpt Text if ( isset($theme_options['excerpt_text']) and $theme_options['excerpt_text'] == true ) : return ' [..]'; else : return ''; endif; } // Custom Template for comments and pingbacks. if ( ! function_exists( 'shapon_list_comments' ) ): function shapon_list_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; if( $comment->comment_type == 'pingback' or $comment->comment_type == 'trackback' ) : ?>
  • id="comment-">

    ', '' ); ?>

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

    $depth, 'max_depth' => $args['max_depth']))) ?>
    'Footer 1', 'id' => 'footer1', 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ' )); } add_action('widgets_init', 'footer1'); /* Add new Footer 2 */ function footer2(){ register_sidebar(array( 'name' => 'Footer 2', 'id' => 'footer2', 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ' )); } add_action('widgets_init', 'footer2'); /* Add new Footer 3 */ function footer3(){ register_sidebar(array( 'name' => 'Footer 3', 'id' => 'footer3', 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ' )); } add_action('widgets_init', 'footer3'); ?>