esc_html__( 'Primary Menu', 'blogbd' ),
) );
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
add_theme_support( 'custom-background', apply_filters( 'blogbd_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
add_theme_support( 'customize-selective-refresh-widgets' );
// Support for default block styles
add_theme_support( 'wp-block-styles' );
// Support for responsive embeds
add_theme_support( 'responsive-embeds' );
// Support for custom logo
add_theme_support( 'custom-logo', array(
'height' => 100,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
) );
// Support for custom header
add_theme_support( 'custom-header', array(
'default-image' => '',
'default-text-color' => 'ffffff',
'width' => 1000,
'height' => 250,
'flex-width' => true,
'flex-height' => true,
'header-text' => true,
) );
// Support for wide alignment
add_theme_support( 'align-wide' );
}
endif;
add_action( 'after_setup_theme', 'blogbd_setup' );
/**
* Define content width
*/
function blogbd_content_width() {
$GLOBALS['content_width'] = apply_filters( 'blogbd_content_width', 640 );
}
add_action( 'after_setup_theme', 'blogbd_content_width', 0 );
/**
* Register Sidebar and Initialize Widgets
*/
function blogbd_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'blogbd' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'blogbd' ),
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'blogbd_widgets_init' );
/**
* Enqueue css and js files
*/
function blogbd_scripts() {
// Enqueue Default Theme Style
wp_enqueue_style( 'blogbd-style', get_stylesheet_uri() );
// Enqueue Font Awesome
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.css', array(), '1.0', 'all' );
// Enqueue jQuery
wp_enqueue_script( 'jquery' );
// Enqueue Custom Navigation
wp_enqueue_script( 'blogbd-navigation', get_template_directory_uri() . '/assets/js/menu.js', array('jquery'), '1.0', true );
// Enqueue Submenu Keyboard Navigation
wp_enqueue_script('blogbd-keyboard-navigation', get_template_directory_uri() . '/assets/js/blogbd-keyboard-navigation.js', array('jquery'), null, true);
}
add_action( 'wp_enqueue_scripts', 'blogbd_scripts' );
/**
* Set default thumbnail size
*/
set_post_thumbnail_size( 1200, 9999 ); // Unlimited height, soft crop
/**
* Define custom thumbnail sizes
*/
add_image_size( 'blogbd-featured', 800, 400, true ); // 800 pixels wide by 400 pixels tall, hard crop mode
/**
* Required files
*/
require get_template_directory() . '/inc/customizer.php';
require get_template_directory() . '/inc/template-tags.php';
require get_template_directory() . '/inc/sanitize.php';
/**
* Register custom block styles
*/
function blogbd_register_block_styles() {
register_block_style(
'core/quote',
array(
'name' => 'fancy-quote',
'label' => __( 'Fancy Quote', 'blogbd' ),
)
);
}
add_action( 'init', 'blogbd_register_block_styles' );
/**
* Register custom block patterns
*/
function blogbd_register_block_patterns() {
register_block_pattern(
'blogbd/hero-section',
array(
'title' => __( 'Hero Section', 'blogbd' ),
'description' => _x( 'A custom hero section with a background image and heading.', 'Block pattern description', 'blogbd' ),
'content' => "\n\n",
)
);
}
add_action( 'init', 'blogbd_register_block_patterns' );
/**
* Add editor styles
*/
function blogbd_add_editor_styles() {
add_editor_style( 'assets/css/editor-style.css' );
}
add_action( 'admin_init', 'blogbd_add_editor_styles' );
/**
* Enqueue the comment-reply script
*/
function blogbd_enqueue_comment_reply_script() {
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'blogbd_enqueue_comment_reply_script' );
function blogbd_custom_excerpt_length( $length ) {
$custom_excerpt_length = get_theme_mod( 'excerpt_length', 20 );
return $custom_excerpt_length;
}
add_filter( 'excerpt_length', 'blogbd_custom_excerpt_length', 999 );
function blogbd_excerpt_more( $more ) {
$read_more_text = get_theme_mod( 'read_more_text', __( 'Read more', 'blogbd' ) );
return '... ' . esc_html( $read_more_text ) . '';
}
add_filter( 'excerpt_more', 'blogbd_excerpt_more' );