__('Primary Navigation', 'blackcanary')
]);
add_theme_support('custom-logo', [
'flex-width' => true,
]);
// Enable post thumbnails
// http://codex.wordpress.org/Post_Thumbnails
// http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size
// http://codex.wordpress.org/Function_Reference/add_image_size
add_theme_support('post-thumbnails');
// Enable post formats
// http://codex.wordpress.org/Post_Formats
add_theme_support('post-formats', ['aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio']);
// Enable HTML5 markup support
// http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']);
// Use main stylesheet for visual editor
// To add custom styles edit /assets/styles/layouts/_tinymce.scss
add_editor_style(Assets\asset_path('styles/main.css'));
}
add_action('after_setup_theme', __NAMESPACE__ . '\\setup');
/**
* Register sidebars
*/
function widgets_init() {
register_sidebar([
'name' => __('Primary', 'blackcanary'),
'id' => 'sidebar-primary',
'before_widget' => '',
'before_title' => '
',
'after_title' => '
'
]);
register_sidebar([
'name' => __('Footer', 'blackcanary'),
'id' => 'sidebar-footer',
'before_widget' => '',
'before_title' => '',
'after_title' => '
'
]);
}
add_action('widgets_init', __NAMESPACE__ . '\\widgets_init');
/*
* Define All Image Sizes
*/
// Basic Sizes
add_action( 'switch_theme', 'Blackcanary_image_size_options' );
function Blackcanary_image_size_options() {
update_option( 'thumbnail_size_w', 300 );
update_option( 'thumbnail_size_h', 100 );
update_option( 'thumbnail_crop', 1 );
update_option( 'medium_size_w', 400 );
update_option( 'medium_size_h', 250 );
update_option( 'large_size_w', 900 );
update_option( 'large_size_h', 600 );
}
// Add Custom Size for slider
add_image_size( 'slide', 1600, 400, array( 'center', 'center' ) );
// Add Custom Size for slider
add_image_size( 'grid', 1200, 400, array( 'center', 'center' ) );
// category-thumbnail
add_image_size( 'category-thumbnail', 320, 200, array( 'center', 'center' ) );
/**
* Determine which pages should NOT display the sidebar
*/
function display_sidebar() {
static $display;
isset($display) || $display = !in_array(true, [
// The sidebar will NOT be displayed if ANY of the following return true.
// @link https://codex.wordpress.org/Conditional_Tags
is_404(),
is_page_template('template-custom.php'),
is_page_template('template-featured.php'),
is_page_template('template-blank.php'),
is_category(),
is_single(),
]);
return apply_filters('blackcanary/display_sidebar', $display);
}
/**
* Theme assets
*/
function assets() {
wp_enqueue_style('blackcanary/css', Assets\asset_path('styles/main.css'), false, null);
if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_enqueue_script('blackcanary/js', Assets\asset_path('scripts/main.js'), ['jquery'], null, true);
}
add_action('wp_enqueue_scripts', __NAMESPACE__ . '\\assets', 100);