esc_html__( 'Sidebar', 'greyboxpro' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'greyboxpro' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 1', 'greyboxpro' ),
'id' => 'footer-1',
'description' => esc_html__( 'Add widgets here.', 'greyboxpro' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 2', 'greyboxpro' ),
'id' => 'footer-2',
'description' => esc_html__( 'Add widgets here.', 'greyboxpro' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 3', 'greyboxpro' ),
'id' => 'footer-3',
'description' => esc_html__( 'Add widgets here.', 'greyboxpro' ),
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'greyboxpro_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function greyboxpro_scripts() {
// load bootstrap css
wp_enqueue_style( 'greyboxpro-bootstrap-css', get_template_directory_uri() . '/inc/assets/css/bootstrap.min.css' );
wp_enqueue_style( 'greyboxpro-fontawesome-cdn', get_template_directory_uri() . '/inc/assets/css/fontawesome.min.css' );
// load bootstrap css
// load AItheme styles
// load GreyboxPro styles
wp_enqueue_style( 'greyboxpro-style', get_stylesheet_uri() );
if(get_theme_mod( 'theme_option_setting' ) && get_theme_mod( 'theme_option_setting' ) !== 'default') {
wp_enqueue_style( 'greyboxpro-'.get_theme_mod( 'theme_option_setting' ), get_template_directory_uri() . '/inc/assets/css/presets/theme-option/'.get_theme_mod( 'theme_option_setting' ).'.css', false, '' );
}
wp_enqueue_script('jquery');
// Internet Explorer HTML5 support
wp_enqueue_script( 'gbphtml5hiv',get_template_directory_uri().'/inc/assets/js/html5.js', array(), '3.7.0', false );
wp_script_add_data( 'gbphtml5hiv', 'conditional', 'lt IE 9' );
// load bootstrap js
wp_enqueue_script('greyboxpro-popper', get_template_directory_uri() . '/inc/assets/js/popper.min.js', array(), '', true );
wp_enqueue_script('greyboxpro-bootstrapjs', get_template_directory_uri() . '/inc/assets/js/bootstrap.min.js', array(), '', true );
wp_enqueue_script('greyboxpro-themejs', get_template_directory_uri() . '/inc/assets/js/theme-script.min.js', array(), '', true );
wp_enqueue_script( 'greyboxpro-skip-link-focus-fix', get_template_directory_uri() . '/inc/assets/js/skip-link-focus-fix.min.js', array(), '20151215', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'greyboxpro_scripts' );
function greyboxpro_password_form() {
global $post;
$label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
$o = '';
return $o;
}
add_filter( 'the_password_form', 'greyboxpro_password_form' );
/* Remove parent theme page templates */
function child_remove_page_templates( $page_templates ) {
unset( $page_templates['fullwidth.php'] );
unset( $page_templates['no-featureimage.php'] );
unset( $page_templates['page.php'] );
return $page_templates;
}
add_filter( 'theme_page_templates', 'child_remove_page_templates' );
add_filter( 'body_class', 'custom_class' );
function custom_class( $classes ) {
if ( is_page_template( 'blog-article-no-banner.php' ) ) {
$classes[] = 'post-template-default';
}
if ( is_page_template( 'light-mode.php' ) ) {
$classes[] = 'page-template-default';
}
return $classes;
}
add_filter( 'body_class', function( $classes ) {
if ( is_page_template( 'blog-article-no-banner.php' ) ) {
foreach($classes as $key => $class) {
if( $class == "post-template" ){
unset($classes[$key]);
}
}
}
if ( is_page_template( 'light-mode.php' ) ) {
foreach($classes as $key => $class) {
if( $class == "page-template" ){
unset($classes[$key]);
}
}
}
return $classes;
}, 1000);
/**
* Get information about available image sizes
*/
function get_image_sizes( $size = '' ) {
$wp_additional_image_sizes = wp_get_additional_image_sizes();
$sizes = array();
$get_intermediate_image_sizes = get_intermediate_image_sizes();
// Create the full array with sizes and crop info
foreach( $get_intermediate_image_sizes as $_size ) {
if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) {
$sizes[ $_size ]['width'] = get_option( $_size . '_size_w' );
$sizes[ $_size ]['height'] = get_option( $_size . '_size_h' );
$sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' );
} elseif ( isset( $wp_additional_image_sizes[ $_size ] ) ) {
$sizes[ $_size ] = array(
'width' => $wp_additional_image_sizes[ $_size ]['width'],
'height' => $wp_additional_image_sizes[ $_size ]['height'],
'crop' => $wp_additional_image_sizes[ $_size ]['crop']
);
}
}
// Get only 1 size if found
if ( $size ) {
if( isset( $sizes[ $size ] ) ) {
return $sizes[ $size ];
} else {
return false;
}
}
return $sizes;
}
// Remove custom image sizes
function remove_extra_image_sizes() {
$wp_additional_image_sizes = wp_get_additional_image_sizes();
foreach ( get_intermediate_image_sizes() as $size ) {
remove_image_size( $size );
}
add_image_size( 'Small', 375);
add_image_size( 'Extra Large', 1920);
}
add_action('init', 'remove_extra_image_sizes');
add_action('admin_head', 'remove_medium_large_size');
function remove_medium_large_size() {
echo '';
}
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
function gbp_admin_login_logo() {
$logo_url = get_template_directory_uri() . '/assets/images/GreyboxPro-logo-1.svg';
?>
'',
'default-text-color' => 'fff',
'width' => 1000,
'height' => 250,
'flex-height' => true,
'wp-head-callback' => '',
) ) );
}
add_action( 'after_setup_theme', 'greyboxpro_custom_header_setup' );
if ( function_exists( 'register_block_style' ) ) {
register_block_style(
'core/quote',
array(
'name' => 'blue-quote',
'label' => __( 'Blue Quote', 'greyboxpro' ),
'is_default' => true,
'inline_style' => '.wp-block-quote.is-style-blue-quote { color: blue; }',
)
);
}
function wpdocs_register_block_patterns() {
register_block_pattern(
'wpdocs/my-example',
array(
'title' => __( 'My First Block Pattern', 'greyboxpro' ),
'description' => _x( 'This is my first block pattern', 'Block pattern description', 'greyboxpro' ),
'content' => 'A single paragraph block style
',
'categories' => array( 'text' ),
'keywords' => array( 'cta', 'demo', 'example' ),
'viewportWidth' => 800,
)
);
}
add_action( 'init', 'wpdocs_register_block_patterns' );
/***
* Add theme supports
*/
add_theme_support( 'custom-logo', array(
'height' => 53,
'width' => 300,
) );
add_theme_support( 'title-tag' );
add_theme_support( 'align-wide' );
add_theme_support( 'wp-block-styles' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'style', 'script' ) );
add_theme_support( 'custom-background' );
/** post thumbnail **/
add_theme_support( 'post-thumbnails' );
/**
* Registers an editor stylesheet for the theme.
*/
function gbp_wpdocs_theme_add_editor_styles() {
add_editor_style( 'custom-editor-style.css' );
}
add_action( 'admin_init', 'gbp_wpdocs_theme_add_editor_styles' );