80,
'width' => 200,
'flex-height' => true,
'flex-width' => true,
));
add_theme_support('html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
));
add_theme_support(
'custom-header',
array(
'width' => 2000,
'height' => 1200,
)
);
add_theme_support('custom-background');
add_theme_support('editor-styles');
add_editor_style('style.css');
register_nav_menus(array(
'primary' => __('Primary Menu', 'bloggerly'),
));
register_block_pattern(
'bloggerly/hero',
array(
'title' => __('Hero Section', 'bloggerly'),
'content' => '
Hero Title
',
)
);
}
add_action('after_setup_theme', 'bloggerly_setup');
/**
* Enqueue Scripts & Styles
*/
function bloggerly_scripts()
{
wp_enqueue_style('bloggerly-style', get_stylesheet_uri(), array(), '1.0.0');
wp_enqueue_script('bloggerly-js', get_template_directory_uri() . '/assets/js/theme.js', array(), '1.0.0', true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
add_action('wp_enqueue_scripts', 'bloggerly_scripts');
/**
* Register Widget Area
*/
function bloggerly_widgets_init()
{
register_sidebar(array(
'name' => __('Sidebar', 'bloggerly'),
'id' => 'sidebar-1',
'description' => __('Add widgets here to appear in your sidebar.', 'bloggerly'),
'before_widget' => '',
'before_title' => '',
));
}
add_action('widgets_init', 'bloggerly_widgets_init');
/**
* Customizer Settings
*/
function bloggerly_customize_register($wp_customize)
{
$wp_customize->add_setting('bloggerly_primary_color', array(
'default' => '#6c5ce7',
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'refresh',
));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'bloggerly_primary_color', array(
'label' => __('Primary Color', 'bloggerly'),
'section' => 'colors',
)));
$wp_customize->add_setting('bloggerly_font_family', array(
'default' => 'sans',
'sanitize_callback' => 'sanitize_key',
'transport' => 'refresh',
));
$wp_customize->add_control('bloggerly_font_family', array(
'label' => __('Body Font Family', 'bloggerly'),
'section' => 'colors',
'type' => 'select',
'choices' => array(
'sans' => 'System Sans-Serif',
'serif' => 'Georgia / Serif',
'mono' => 'Monospace',
),
));
}
add_action('customize_register', 'bloggerly_customize_register');
/**
* Output Customizer CSS
*/
function bloggerly_customizer_css()
{
$primary = get_theme_mod('bloggerly_primary_color', '#6c5ce7');
$font_choice = get_theme_mod('bloggerly_font_family', 'sans');
$font_css = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif';
if ('serif' === $font_choice) {
$font_css = '"Georgia", "Times New Roman", Times, serif';
} elseif ('mono' === $font_choice) {
$font_css = '"Courier New", Courier, monospace';
}
if ($primary !== '#6c5ce7' || $font_choice !== 'sans') {
?>
is_main_query() && $query->is_home()) {
$query->set('posts_per_page', 9);
}
}
add_action('pre_get_posts', 'bloggerly_query_adjustments');
/**
* Enable SVG Uploads
*/
function bloggerly_add_svg_uploads($file_types)
{
$new_filetypes = array();
$new_filetypes['svg'] = 'image/svg+xml';
$file_types = array_merge($file_types, $new_filetypes);
return $file_types;
}
/**
* Register custom block styles.
*/
function bloggerly_register_block_styles()
{
register_block_style(
'core/paragraph',
array(
'name' => 'highlight-paragraph',
'label' => __('Highlight Paragraph', 'bloggerly'),
)
);
}
add_action('init', 'bloggerly_register_block_styles');