for posts and comments. add_theme_support( 'automatic-feed-links' ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); // Register WordPress Custom Menus add_theme_support( 'menus' ); register_nav_menu( 'main-menu', __( 'Main Menu', 'bloomy' ) ); // Register Post Thumbnails add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 150, 150, true ); add_image_size( 'bloomy-slider', 1170, 546, true ); add_image_size( 'bloomy-featured', 875, 430, true ); add_image_size( 'bloomy-related', 265, 145, true ); add_image_size( 'bloomy-widgetthumb-big', 276, 125, true ); add_image_size( 'bloomy-widgetthumb', 70, 70, true ); /* * Enable support for custom logo. * */ add_theme_support( 'custom-logo', array( 'height' => 96, 'width' => 278, 'flex-width' => true, ) ); /* * 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' ) ); add_editor_style( array( 'css/editor-style.css') ); // Load Localization Files $lang_dir = get_template_directory() . '/languages'; load_theme_textdomain( 'bloomy', $lang_dir ); } endif; // twentyfifteen_setup add_action( 'after_setup_theme', 'bloomy_theme_setup' ); /*-----------------------------------------------------------------------------------*/ /* Add Stylesheets /*-----------------------------------------------------------------------------------*/ function bloomy_stylesheets_scripts() { // Add Stylesheets //------------------------------------------------// // Default Stylesheet wp_enqueue_style( 'bloomy-style', get_stylesheet_uri(), array(), null, 'all' ); // Font Awesome Icons wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), null, 'all' ); // Responsive wp_enqueue_style( 'bloomy-responsive', get_template_directory_uri() . '/css/responsive.css', array(), null, 'all' ); if ( bloomy_theme_mod( 'rtl' ) == 'enable' ) { // Responsive wp_enqueue_style( 'bloomy-rtl', get_template_directory_uri() . '/rtl.css' ); } // Add JavaScripts //------------------------------------------------// wp_enqueue_script( 'jquery' ); if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); // Sticky Menu $bloomy_sticky_menu = bloomy_theme_mod('sticky_menu'); if ( $bloomy_sticky_menu == 'enable' ) { wp_enqueue_script( 'bloomy-stickymenu', get_template_directory_uri() . '/js/stickymenu.js', array( 'jquery' ), null, true ); } // Owl Carousel wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/js/owl.carousel.js', array( 'jquery' ), '1.0', true ); // Fitvids wp_enqueue_script( 'fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', array( 'jquery' ), '1.1', true ); // Required jQuery Scripts wp_enqueue_script( 'bloomy-theme-scripts', get_template_directory_uri() . '/js/theme-scripts.js', array( 'jquery' ), null, true ); } add_action( 'wp_enqueue_scripts', 'bloomy_stylesheets_scripts', 99 ); /*-----------------------------------------------------------------------------------*/ /* Add Admin Scripts /*-----------------------------------------------------------------------------------*/ function bloomy_admin_scripts() { wp_register_script( 'admin-scripts', get_template_directory_uri() . '/js/admin-scripts.js', array( 'jquery' ), '1.0', true ); wp_enqueue_script( 'admin-scripts' ); wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css' ); wp_register_style( 'admin-css', get_template_directory_uri() . '/css/admin-styles.css' ); wp_enqueue_style( 'admin-css' ); wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script('wp-color-picker'); } add_action( 'admin_enqueue_scripts', 'bloomy_admin_scripts' ); /*-----------------------------------------------------------------------------------*/ /* Load Widgets /*-----------------------------------------------------------------------------------*/ // Theme Functions include("inc/widgets/widget-author-info.php"); // Author Info Widget include("inc/widgets/widget-cat-posts.php"); // Category Posts include("inc/widgets/widget-recent-posts.php"); // Recent Posts include("inc/widgets/widget-social.php"); // Social Widget /*-----------------------------------------------------------------------------------*/ /* Exceprt Length /*-----------------------------------------------------------------------------------*/ // Limit the Length of Excerpt function bloomy_excerpt_length( $excerpt_length ) { $excerpt_length = bloomy_theme_mod( 'excerpt_length', '40' ); if ( $excerpt_length == '' ) { $excerpt_length = '40'; } return $excerpt_length; } add_filter( 'excerpt_length', 'bloomy_excerpt_length', 999 ); // Remove […] string function bloomy_excerpt_more( $more ) { return ''; } add_filter('excerpt_more', 'bloomy_excerpt_more'); // Add Shortcodes in Excerpt Field add_filter( 'get_the_excerpt', 'do_shortcode'); /*-----------------------------------------------------------------------------------*/ /* Register Theme Widgets /*-----------------------------------------------------------------------------------*/ function bloomy_widgets_init() { register_sidebar(array( 'name' => __('Primary Sidebar', 'bloomy'), 'id' => 'sidebar-1', 'before_widget' => '<div class="widget sidebar-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', )); $bloomy_footer_columns = ( !empty( get_theme_mod('footer_layout','4') ) ? get_theme_mod('footer_layout','4') : '' ); for ( $i = 1; $i <= $bloomy_footer_columns; $i++ ) { register_sidebar( array( 'name' => sprintf( esc_html__( 'Footer %s','bloomy' ), $i ), 'id' => 'footer-' . $i, 'description' => esc_html__( 'This widget area appears on footer of theme.', 'bloomy' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); } } add_action( 'widgets_init', 'bloomy_widgets_init' ); /*-----------------------------------------------------------------------------------*/ /* Breadcrumb /*-----------------------------------------------------------------------------------*/ function bloomy_breadcrumb() { if (!is_home()) { echo '<span itemtype="http://schema.org/ListItem" itemscope="" itemprop="itemListElement" class="breadcrumb-item">'; echo '<a itemprop="item" href="'; echo esc_url( home_url() ); echo '">'; echo '<span itemprop="name">'; echo __( 'Home','bloomy' ); echo "</span>"; echo "</a>"; echo "</span>"; if (is_category() || is_single()) { echo "  /  "; echo '<span itemtype="http://schema.org/ListItem" itemscope="" itemprop="itemListElement" class="breadcrumb-item">'; echo '<span itemprop="item">'; the_category(' • '); echo "</span>"; echo "</span>"; if (is_single()) { echo "  /  "; echo '<span itemtype="http://schema.org/ListItem" itemscope="" itemprop="itemListElement" class="breadcrumb-item">'; echo '<span itemprop="item">'; the_title(); echo "</span>"; echo "</span>"; } } elseif (is_page()) { echo "  /  "; echo the_title(); } } } /*-----------------------------------------------------------------------------------*/ /* Comments Callback /*-----------------------------------------------------------------------------------*/ function bloomy_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; extract($args, EXTR_SKIP); ?> <li <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>"> <?php if ( 'div' != $args['style'] ) : ?> <div id="div-comment-<?php comment_ID() ?>" class="comment-body" itemscope itemtype="http://schema.org/UserComments"> <?php endif; ?> <div class="comment-author vcard" > <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment->comment_author_email, 70 ); ?> <?php printf(__('<span class="fn" itemprop="creator" itemscope itemtype="http://schema.org/Person"><span itemprop="name">%s</span></span>','bloomy'), get_comment_author_link()) ?> </div> <div class="commentBody"> <span class="comment-meta"> <time itemprop="commentTime" datetime="<?php echo esc_attr( get_comment_date( 'c' ) ); ?>"> <?php printf( __('%1$s','bloomy'), get_comment_date(), get_comment_time()) ?> </time> <?php edit_comment_link(__('(Edit)','bloomy'),' ','' );?> </span> <?php if ($comment->comment_approved == '0') : ?> <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.','bloomy') ?></em> <br /> <?php endif; ?> <div class="comment-content entry-content" itemprop="commentText"> <?php comment_text() ?> </div> <div class="reply"> <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __(' Reply','bloomy')))) ?> </div> </div><!--.commentBody--> </div> <?php } /*-----------------------------------------------------------------------------------*/ /* Custom theme mod functions /*-----------------------------------------------------------------------------------*/ function bloomy_theme_mod( $name ) { global $bloomy_theme_defaults; return get_theme_mod( $name, $bloomy_theme_defaults[ $name ] ); } ?>