__( 'Footer A', 'radcliffe' ),
'id' => 'footer-a',
'description' => __( 'Widgets in this area will be shown in the left column in the footer.', 'radcliffe' ),
'before_title' => '
',
'before_widget' => ''
) );
register_sidebar( array(
'name' => __( 'Footer B', 'radcliffe' ),
'id' => 'footer-b',
'description' => __( 'Widgets in this area will be shown in the middle column in the footer.', 'radcliffe' ),
'before_title' => '',
'before_widget' => ''
) );
register_sidebar( array(
'name' => __( 'Footer C', 'radcliffe' ),
'id' => 'footer-c',
'description' => __( 'Widgets in this area will be shown in the right column in the footer.', 'radcliffe' ),
'before_title' => '',
'before_widget' => ''
) );
}
add_action( 'widgets_init', 'radcliffe_widget_areas_registration' );
}
/* ---------------------------------------------------------------------------------------------
ADD PAGINATION CLASSES
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'radcliffe_posts_link_attributes_1' ) ) {
function radcliffe_posts_link_attributes_1() {
return 'class="post-nav-older"';
}
add_filter('next_posts_link_attributes', 'radcliffe_posts_link_attributes_1');
}
if ( ! function_exists( 'radcliffe_posts_link_attributes_2' ) ) {
function radcliffe_posts_link_attributes_2() {
return 'class="post-nav-newer"';
}
add_filter('previous_posts_link_attributes', 'radcliffe_posts_link_attributes_2');
}
/* ---------------------------------------------------------------------------------------------
CUSTOM MORE LINK TEXT
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'radcliffe_custom_more_link' ) ) {
function radcliffe_custom_more_link( $more_link, $more_link_text ) {
return str_replace( $more_link_text, __( 'Continue reading', 'radcliffe' ), $more_link );
}
add_filter( 'the_content_more_link', 'radcliffe_custom_more_link', 10, 2 );
}
/* ---------------------------------------------------------------------------------------------
BODY & POST CLASSES
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'radcliffe_body_post_classes' ) ) {
function radcliffe_body_post_classes( $classes ) {
// If has post thumbnail
$classes[] = has_post_thumbnail() ? 'has-featured-image' : 'no-featured-image';
return $classes;
}
add_filter( 'post_class', 'radcliffe_body_post_classes' );
add_filter( 'body_class', 'radcliffe_body_post_classes' );
}
/* ---------------------------------------------------------------------------------------------
ADMIN CSS
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'radcliffe_admin_css' ) ) {
function radcliffe_admin_css() { ?>
comment_type ) :
case 'pingback' :
case 'trackback' :
?>
id="comment-">
', '' ); ?>
id="li-comment-">
add_section( 'radcliffe_options',
array(
'title' => __( 'Radcliffe Options', 'radcliffe' ),
'priority' => 35,
'capability' => 'edit_theme_options',
'description' => __( 'Allows you to customize theme settings for Radcliffe.', 'radcliffe'),
)
);
$wp_customize->add_section( 'radcliffe_logo_section' , array(
'title' => __( 'Logo', 'radcliffe' ),
'priority' => 40,
'description' => __('Upload a logo to replace the default site name and description in the header','radcliffe'),
) );
//2. Register new settings to the WP database...
$wp_customize->add_setting( 'accent_color',
array(
'default' => '#ca2017',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_hex_color'
)
);
$wp_customize->add_setting( 'radcliffe_logo',
array(
'sanitize_callback' => 'esc_url_raw'
)
);
//3. Finally, we define the control itself (which links a setting to a section and renders the HTML controls)...
$wp_customize->add_control( new WP_Customize_Color_Control(
$wp_customize,
'radcliffe_accent_color',
array(
'label' => __( 'Accent Color', 'radcliffe' ),
'section' => 'colors',
'settings' => 'accent_color',
'priority' => 10,
)
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'radcliffe_logo', array(
'label' => __( 'Logo', 'radcliffe' ),
'section' => 'radcliffe_logo_section',
'settings' => 'radcliffe_logo',
) ) );
//4. We can also change built-in settings by modifying properties. For instance, let's make some stuff use live preview JS...
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
}
public static function radcliffe_header_output() {
echo ' ';
echo '';
echo '';
}
public static function radcliffe_live_preview() {
wp_enqueue_script( 'radcliffe-themecustomizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'jquery', 'customize-preview' ), '', true );
}
public static function radcliffe_generate_css( $selector, $style, $mod_name, $prefix='', $postfix='', $echo=true ) {
$return = '';
$mod = get_theme_mod($mod_name);
if ( ! empty( $mod ) ) {
$return = sprintf('%s { %s:%s; }',
$selector,
$style,
$prefix.$mod.$postfix
);
if ( $echo ) {
echo $return;
}
}
return $return;
}
}
// Setup the Theme Customizer settings and controls...
add_action( 'customize_register' , array( 'Radcliffe_Customize' , 'radcliffe_register' ) );
// Output custom CSS to live site
add_action( 'wp_head' , array( 'Radcliffe_Customize' , 'radcliffe_header_output' ) );
// Enqueue live preview javascript in Theme Customizer admin screen
add_action( 'customize_preview_init' , array( 'Radcliffe_Customize' , 'radcliffe_live_preview' ) );
/* ---------------------------------------------------------------------------------------------
SPECIFY GUTENBERG SUPPORT
------------------------------------------------------------------------------------------------ */
if ( ! function_exists( 'radcliffe_add_gutenberg_features' ) ) :
function radcliffe_add_gutenberg_features() {
/* Gutenberg Feature Opt-Ins --------------------------------------- */
add_theme_support( 'align-wide' );
/* Gutenberg Palette --------------------------------------- */
$accent_color = get_theme_mod( 'accent_color' ) ? get_theme_mod( 'accent_color' ) : '#ca2017';
add_theme_support( 'editor-color-palette', array(
array(
'name' => _x( 'Accent', 'Name of the accent color in the Gutenberg palette', 'radcliffe' ),
'slug' => 'accent',
'color' => $accent_color,
),
array(
'name' => _x( 'Black', 'Name of the black color in the Gutenberg palette', 'radcliffe' ),
'slug' => 'black',
'color' => '#222',
),
array(
'name' => _x( 'Dark Gray', 'Name of the dark gray color in the Gutenberg palette', 'radcliffe' ),
'slug' => 'dark-gray',
'color' => '#444',
),
array(
'name' => _x( 'Medium Gray', 'Name of the medium gray color in the Gutenberg palette', 'radcliffe' ),
'slug' => 'medium-gray',
'color' => '#666',
),
array(
'name' => _x( 'Light Gray', 'Name of the light gray color in the Gutenberg palette', 'radcliffe' ),
'slug' => 'light-gray',
'color' => '#888',
),
array(
'name' => _x( 'White', 'Name of the white color in the Gutenberg palette', 'radcliffe' ),
'slug' => 'white',
'color' => '#fff',
),
) );
/* Gutenberg Font Sizes --------------------------------------- */
add_theme_support( 'editor-font-sizes', array(
array(
'name' => _x( 'Small', 'Name of the small font size in Gutenberg', 'radcliffe' ),
'shortName' => _x( 'S', 'Short name of the small font size in the Gutenberg editor.', 'radcliffe' ),
'size' => 16,
'slug' => 'small',
),
array(
'name' => _x( 'Regular', 'Name of the regular font size in Gutenberg', 'radcliffe' ),
'shortName' => _x( 'M', 'Short name of the regular font size in the Gutenberg editor.', 'radcliffe' ),
'size' => 18,
'slug' => 'regular',
),
array(
'name' => _x( 'Large', 'Name of the large font size in Gutenberg', 'radcliffe' ),
'shortName' => _x( 'L', 'Short name of the large font size in the Gutenberg editor.', 'radcliffe' ),
'size' => 24,
'slug' => 'large',
),
array(
'name' => _x( 'Larger', 'Name of the larger font size in Gutenberg', 'radcliffe' ),
'shortName' => _x( 'XL', 'Short name of the larger font size in the Gutenberg editor.', 'radcliffe' ),
'size' => 32,
'slug' => 'larger',
),
) );
}
add_action( 'after_setup_theme', 'radcliffe_add_gutenberg_features' );
endif;
/* ---------------------------------------------------------------------------------------------
GUTENBERG EDITOR STYLES
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'radcliffe_block_editor_styles' ) ) :
function radcliffe_block_editor_styles() {
$dependencies = array();
/**
* Translators: If there are characters in your language that are not
* supported by the theme fonts, translate this to 'off'. Do not translate
* into your own language.
*/
$google_fonts = _x( 'on', 'Google Fonts: on or off', 'radcliffe' );
if ( 'off' !== $google_fonts ) {
// Register Google Fonts
wp_register_style( 'radcliffe-block-editor-styles-font', '//fonts.googleapis.com/css?family=Open+Sans:300,400,400italic,600,700,700italic,800|Crimson+Text:400,400italic,700,700italic|Abril+Fatface:400', false, 1.0, 'all' );
$dependencies[] = 'radcliffe-block-editor-styles-font';
}
// Enqueue the editor styles
wp_enqueue_style( 'radcliffe-block-editor-styles', get_theme_file_uri( '/radcliffe-gutenberg-editor-style.css' ), $dependencies, '1.0', 'all' );
}
add_action( 'enqueue_block_editor_assets', 'radcliffe_block_editor_styles', 1 );
endif;
?>