Yuzu Theme

from meowapps.com
This commit is contained in:
2022-05-03 09:37:05 +02:00
commit 523ccac38e
75 changed files with 15482 additions and 0 deletions

73
inc/apply-colors.php Normal file
View File

@@ -0,0 +1,73 @@
<?php
function convert_hex_to_rgba($color, $opacity = false) {
$default = 'rgb(0,0,0)';
//Return default if no color provided
if(empty($color))
return $default;
//Sanitize $color if "#" is provided
if ($color[0] == '#' ) {
$color = substr( $color, 1 );
}
//Check if color has 6 or 3 characters and get values
if (strlen($color) == 6) {
$hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
} elseif ( strlen( $color ) == 3 ) {
$hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
} else {
return $default;
}
//Convert hexadec to rgb
$rgb = array_map('hexdec', $hex);
//Check if opacity is set(rgba or rgb)
if($opacity){
if(abs($opacity) > 1)
$opacity = 1.0;
$output = 'rgba('.implode(",",$rgb).','.$opacity.')';
} else {
$output = 'rgb('.implode(",",$rgb).')';
}
//Return rgb(a) color string
return $output;
}
function yuzu_customizer_head_styles() {
?>
<style type="text/css" class="customizer-colors">
body.custom-theme {
--top_bar_color: <?= get_theme_mod('top_bar_color', '#2E3B4F'); ?>;
--body_color: <?= get_theme_mod('body_color', '#2E3B4F'); ?>;
--footer_color: <?= get_theme_mod('footer_color', '#2E3B4F'); ?>;
--card_color: <?= get_theme_mod('card_color', '#2E3B4F'); ?>;
--link_color: <?= get_theme_mod('link_color', '#4B828E'); ?>;
--link_hover_color: <?= get_theme_mod('link_hover_color', '#39636D'); ?>;
--tag_color: <?= get_theme_mod('tag_color', '#4B828E'); ?>;
--tag_hover_color: <?= get_theme_mod('tag_hover_color', '#39636D'); ?>;
--search_widget_color: <?= get_theme_mod('search_widget_color', '#2E3B4F'); ?>;
--read_more_btn_color: <?= get_theme_mod('read_more_btn_color', '#2E3B4F'); ?>;
--comment_color: <?= get_theme_mod('comment_color', '#2E3B4F'); ?>;
--comment_form_color: <?= get_theme_mod('comment_form_color', '#2E3B4F'); ?>;
--post_comment_btn_color: <?= get_theme_mod('comment_form_color', '#2E3B4F'); ?>;
--top_bar_bg: <?= get_theme_mod('top_bar_bg', '#fff'); ?>;
--body_bg: <?= get_theme_mod('body_bg', '#FAFBFB'); ?>;
--very_opaque_header_bg: linear-gradient(to top, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), 1) ?>, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), .9) ?>);
--opaque_header_bg: linear-gradient(to top, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), 1) ?>, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), .6) ?>);
--less_opaque_header_bg: linear-gradient(to top, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), 1) ?>, <?= convert_hex_to_rgba(get_theme_mod('body_bg', '#FAFBFB'), .4) ?>);
--footer_bg: <?= get_theme_mod('footer_bg', '#FFF'); ?>;
--card_bg: <?= get_theme_mod('card_bg', '#FFF'); ?>;
--search_widget_bg: <?= get_theme_mod('search_widget_bg', '#f5f4f4'); ?>;
--read_more_btn_bg: <?= get_theme_mod('read_more_btn_bg', '#F5F5F5'); ?>;
--comment_bg: <?= get_theme_mod('comment_bg', '#FFF'); ?>;
--comment_form_bg: <?= get_theme_mod('comment_form_bg', '#FFF'); ?>;
--post_comment_btn_bg: <?= get_theme_mod('comment_form_bg', '#FFF'); ?>;
}
</style>
<?php
}
add_action( 'wp_head', 'yuzu_customizer_head_styles' );

1061
inc/custom-controls.php Normal file

File diff suppressed because it is too large Load Diff

72
inc/custom-header.php Normal file
View File

@@ -0,0 +1,72 @@
<?php
/**
* Sample implementation of the Custom Header feature
*
* You can add an optional custom header image to header.php like so ...
*
<?php the_header_image_tag(); ?>
*
* @link https://developer.wordpress.org/themes/functionality/custom-headers/
*
* @package Yuzu
*/
/**
* Set up the WordPress core custom header feature.
*
* @uses yuzu_header_style()
*/
function yuzu_custom_header_setup() {
add_theme_support( 'custom-header', apply_filters( 'yuzu_custom_header_args', array(
'default-image' => '',
'default-text-color' => '000000',
'width' => 1000,
'height' => 250,
'flex-height' => true,
'wp-head-callback' => 'yuzu_header_style',
) ) );
}
add_action( 'after_setup_theme', 'yuzu_custom_header_setup' );
if ( ! function_exists( 'yuzu_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog.
*
* @see yuzu_custom_header_setup().
*/
function yuzu_header_style() {
$header_text_color = get_header_textcolor();
/*
* If no custom options for text are set, let's bail.
* get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ).
*/
if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
return;
}
// If we get this far, we have custom styles. Let's do this.
?>
<style type="text/css">
<?php
// Has the text been hidden?
if ( ! display_header_text() ) :
?>
.site-title,
.site-description {
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
}
<?php
// If the user has set a custom color for the text use that.
else :
?>
.site-title a,
.site-description {
color: #<?php echo esc_attr( $header_text_color ); ?>;
}
<?php endif; ?>
</style>
<?php
}
endif;

View File

@@ -0,0 +1,402 @@
<?php
function create_color_control( $args, $wp_customize ) {
$wp_customize->add_setting(
$args['setting'], array(
'default' => $args['default'],
'transport' => 'refresh'
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
$args['setting'],
array(
'label' => $args['label'],
'description' => $args['description'],
'section' => $args['section'],
'settings' => $args['setting'],
'active_callback' => $args['active_callback']
)
)
);
}
/* =============================================== */
// # COLORS SECTION
/* =============================================== */
$wp_customize->add_section( 'colors_section', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Colors', 'yuzu' ),
'description' => '',
'panel' => 'theme_settings',
) );
/* =============================================== */
// ## Scheme
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-color-sheme-accordion',
array(
'section' => 'colors_section',
'label' => __( 'Color Scheme', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'color_scheme', array(
'default' => 'light',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control(
'color_scheme',
array(
'type' => 'radio',
'label' => __('Color Scheme', 'yuzu'),
'section' => 'colors_section',
'choices' => array(
'light' => __('Light Theme (default)', 'yuzu'),
'dark' => __('Dark Theme', 'yuzu'),
'custom' => __('Custom Theme', 'yuzu'),
)
)
);
function is_custom_scheme_callback( $control ) {
if ( $control->manager->get_setting('color_scheme')->value() == 'custom' ) {
return true;
} else {
return false;
}
}
/* =============================================== */
// ## Backgrounds
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-backgrounds-colors-accordion',
array(
'section' => 'colors_section',
'label' => __( 'Backgrounds', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'bg_not_editable_notice',
array(
'default' => '',
'transport' => 'postMessage',
'sanitize_callback' => 'skyrocket_text_sanitization'
)
);
$wp_customize->add_control( new Skyrocket_Simple_Notice_Custom_control( $wp_customize, 'bg_not_editable_notice',
array(
'label' => __( 'Unavailable', 'yuzu' ),
'description' => __('Please select "Custom Scheme" in order to be able to edit colors individually.', 'yuzu' ),
'section' => 'colors_section',
'active_callback' => function(){
if(get_theme_mod( 'color_scheme', 'light' ) != 'custom')
return true;
}
)
) );
$args = array(
'setting' => 'top_bar_bg',
'section' => 'colors_section',
'label' => 'Top Bar Background',
'description' => '',
'default' => '#FFF',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'body_bg',
'section' => 'colors_section',
'label' => 'Body Background',
'description' => '',
'default' => '#FAFBFB',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'footer_bg',
'section' => 'colors_section',
'label' => 'Footer Background',
'description' => '',
'default' => '#F6F7FB',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'card_bg',
'section' => 'colors_section',
'label' => 'Cards Background',
'description' => '',
'default' => '#F6F7FB',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'search_widget_bg',
'section' => 'colors_section',
'label' => 'Search Field Background',
'description' => '',
'default' => '#f5f4f4',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'comment_bg',
'section' => 'colors_section',
'label' => 'Comment Background',
'description' => '',
'default' => '#F6F7FB',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'comment_form_bg',
'section' => 'colors_section',
'label' => 'Comment Form Background',
'description' => '',
'default' => '#F6F7FB',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
/* =============================================== */
// ## Texts
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-text-colors-accordion',
array(
'section' => 'colors_section',
'label' => __( 'Font Colors', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'color_not_editable_notice',
array(
'default' => '',
'transport' => 'postMessage',
'sanitize_callback' => 'skyrocket_text_sanitization'
)
);
$wp_customize->add_control( new Skyrocket_Simple_Notice_Custom_control( $wp_customize, 'color_not_editable_notice',
array(
'label' => __( 'Unavailable', 'yuzu' ),
'description' => __('Please select "Custom Scheme" in order to be able to edit colors individually.', 'yuzu' ),
'section' => 'colors_section',
'active_callback' => function(){
if(get_theme_mod( 'color_scheme', 'light' ) != 'custom')
return true;
}
)
) );
$args = array(
'setting' => 'link_color',
'section' => 'colors_section',
'label' => 'Link Color',
'description' => '',
'default' => '#4B828E',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'link_hover_color',
'section' => 'colors_section',
'label' => 'Hovered Link Color',
'description' => '',
'default' => '#39636D',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'top_bar_color',
'section' => 'colors_section',
'label' => 'Top Bar Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback',
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'body_color',
'section' => 'colors_section',
'label' => 'Body Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'footer_color',
'section' => 'colors_section',
'label' => 'Footer Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'card_color',
'section' => 'colors_section',
'label' => 'Cards Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'search_widget_color',
'section' => 'colors_section',
'label' => 'Search Field Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'comment_color',
'section' => 'colors_section',
'label' => 'Comment Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'comment_form_color',
'section' => 'colors_section',
'label' => 'Comment Form Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
/* =============================================== */
// ## Others
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-other-colors-accordion',
array(
'section' => 'colors_section',
'label' => __( 'Others', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'other_not_editable_notice',
array(
'default' => '',
'transport' => 'postMessage',
'sanitize_callback' => 'skyrocket_text_sanitization'
)
);
$wp_customize->add_control( new Skyrocket_Simple_Notice_Custom_control( $wp_customize, 'other_not_editable_notice',
array(
'label' => __( 'Unavailable', 'yuzu' ),
'description' => __('Please select "Custom Scheme" in order to be able to edit colors individually.', 'yuzu' ),
'section' => 'colors_section',
'active_callback' => function(){
if(get_theme_mod( 'color_scheme', 'light' ) != 'custom')
return true;
}
)
) );
$args = array(
'setting' => 'tag_color',
'section' => 'colors_section',
'label' => 'Tags Color',
'description' => '',
'default' => '#4B828E',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'tag_hover_color',
'section' => 'colors_section',
'label' => 'Hovered Tag Color',
'description' => '',
'default' => '#39636D',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'read_more_btn_bg',
'section' => 'colors_section',
'label' => 'Read More Button Background',
'description' => '',
'default' => '#F5F5F5',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'read_more_btn_color',
'section' => 'colors_section',
'label' => 'Read More Button Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'post_comment_btn_bg',
'section' => 'colors_section',
'label' => 'Post Comment Button Background',
'description' => '',
'default' => '#F5F5F5',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'post_comment_btn_color',
'section' => 'colors_section',
'label' => 'Post Comment Button Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );

View File

@@ -0,0 +1,131 @@
<?php
/* =============================================== */
// # GENERAL SECTION
/* =============================================== */
$wp_customize->add_section( 'general_section', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'General', 'yuzu' ),
'description' => '',
'panel' => 'theme_settings',
) );
/* =============================================== */
// ## SOCIAL NETWORKS
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-social-networks-accordion',
array(
'section' => 'general_section',
'label' => __( 'Social Networks', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting(
'instagram_url',
array(
'default' => '',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'instagram_url',
array(
'label' => __('Instagram URL', 'yuzu'),
'description' => __('To hide it, leave it blank.', 'yuzu'),
'section' => 'general_section',
'type' => 'text'
)
);
$wp_customize->add_setting(
'facebook_url',
array(
'default' => '',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'facebook_url',
array(
'label' => __('Facebook URL', 'yuzu'),
'description' => __('To hide it, leave it blank.', 'yuzu'),
'section' => 'general_section',
'type' => 'text'
)
);
$wp_customize->add_setting(
'twitter_url',
array(
'default' => '',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'twitter_url',
array(
'label' => __('Twitter URL', 'yuzu'),
'description' => __('To hide it, leave it blank.', 'yuzu'),
'section' => 'general_section',
'type' => 'text'
)
);
$wp_customize->add_setting(
'flickr_url',
array(
'default' => '',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'flickr_url',
array(
'label' => __('Flickr URL', 'yuzu'),
'description' => __('To hide it, leave it blank.', 'yuzu'),
'section' => 'general_section',
'type' => 'text'
)
);
/* =============================================== */
// ## COPYRIGHT
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-copyright-infos-accordion',
array(
'section' => 'general_section',
'label' => __( 'Copyright', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting(
'copyright_text',
array(
'default' => '&copy; Yuzu Theme 2018',
'transport' => 'refresh',
'sanitize_callback' => 'wp_kses_post',
)
);
$wp_customize->add_control(
'copyright_text',
array(
'label' => __('Copyright Text', 'yuzu'),
'section' => 'general_section',
'type' => 'text'
)
);

View File

@@ -0,0 +1,127 @@
<?php
/* =============================================== */
// # LAYOUT SECTION
/* =============================================== */
$wp_customize->add_section( 'layout_section', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Layout', 'yuzu' ),
'description' => '',
'panel' => 'theme_settings',
) );
/* =============================================== */
// ## Top Bar
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-top-bar-layout-setting-accordion',
array(
'section' => 'layout_section',
'label' => __( 'Top Bar', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'enable_search_in_top_bar', array(
'default' => true,
'transport' => 'refresh',
) );
$wp_customize->add_control(
'enable_search_in_top_bar',
array(
'type' => 'checkbox',
'label' => __('Enable search in the top bar.', 'yuzu'),
'section' => 'layout_section',
)
);
/* =============================================== */
// ## Blog
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-blog-layout-setting-accordion',
array(
'section' => 'layout_section',
'label' => __( 'Blog', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'enable_posts_height_equalizer', array(
'default' => true,
'transport' => 'refresh',
) );
$wp_customize->add_control(
'enable_posts_height_equalizer',
array(
'type' => 'checkbox',
'label' => __('Equalize articles cards height.', 'yuzu'),
'section' => 'layout_section',
)
);
$wp_customize->add_setting( 'display_posts_navigation', array(
'default' => true,
'transport' => 'refresh',
) );
$wp_customize->add_control(
'display_posts_navigation',
array(
'type' => 'checkbox',
'label' => __('Display previous/next articles at the bottom of articles.', 'yuzu'),
'section' => 'layout_section',
)
);
$wp_customize->add_setting( 'display_posts_meta', array(
'default' => true,
'transport' => 'refresh',
) );
$wp_customize->add_control(
'display_posts_meta',
array(
'type' => 'checkbox',
'label' => __('Display article metadata.', 'yuzu'),
'section' => 'layout_section',
)
);
/* =============================================== */
// ## Other
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-other-layout-setting-accordion',
array(
'section' => 'layout_section',
'label' => __( 'Others', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'enable_scroll_back_to_top_btn', array(
'default' => true,
'transport' => 'refresh',
) );
$wp_customize->add_control(
'enable_scroll_back_to_top_btn',
array(
'type' => 'checkbox',
'label' => __('Display a button to scroll back to top of the page.', 'yuzu'),
'section' => 'layout_section',
)
);

View File

@@ -0,0 +1,46 @@
<?php
/* =============================================== */
// # STYLE SECTION
/* =============================================== */
$wp_customize->add_section( 'style_section', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Style', 'yuzu' ),
'description' => '',
'panel' => 'theme_settings',
) );
/* =============================================== */
// ## Headers
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-headers-style-sheme-accordion',
array(
'section' => 'style_section',
'label' => __( 'Headers', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'header_background_opacity', array(
'default' => 'normal-opaque',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control(
'header_background_opacity',
array(
'type' => 'radio',
'label' => __('Header Background Opacity', 'yuzu'),
'section' => 'style_section',
'choices' => array(
'less-opaque' => __('Less opaque', 'yuzu'),
'normal-opaque' => __('Normal', 'yuzu'),
'very-opaque' => __('Very opaque', 'yuzu'),
)
)
);

65
inc/customizer.php Normal file
View File

@@ -0,0 +1,65 @@
<?php
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'yuzu_Customizer_Header' ) ) :
class yuzu_Customizer_Title extends WP_Customize_Control {
public $settings = 'blogname';
public $description = '';
public function render_content() {
switch ( $this->type ) {
default:
case 'heading':
echo '<span class="customize-control-title">' . esc_html( $this->label ) . '</span>';
break;
}
}
}
class yuzu_Customizer_Accordion extends WP_Customize_Control {
public $settings = 'blogname';
public $description = '';
public function render_content() {
switch ( $this->type ) {
default:
case 'accordion':
echo '
<div class="accordion-title" style="width: 100%; background: white; padding: 0px 14px; box-sizing: border-box; border: 1px solid #ddd; border-left: 3px solid #0073aa; margin: 10px 0;">
<h3>'. esc_html( $this->label ) .'</h3>
</div>';
break;
}
}
}
endif;
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function yuzu_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->remove_section('colors');
$wp_customize->remove_section('header_image');
$wp_customize->remove_section('background_image');
$wp_customize->remove_control('blogdescription');
$wp_customize->remove_control('display_header_text');
$wp_customize->add_panel( 'theme_settings', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Yuzu Theme Settings', 'yuzu' ),
'description' => __( 'All the settings for yuzu Theme', 'yuzu' ),
) );
require get_template_directory() . '/inc/customizer-sections/general-section.php';
require get_template_directory() . '/inc/customizer-sections/layout-section.php';
require get_template_directory() . '/inc/customizer-sections/style-section.php';
require get_template_directory() . '/inc/customizer-sections/colors-section.php';
}
add_action( 'customize_register', 'yuzu_customize_register' );

80
inc/jetpack.php Normal file
View File

@@ -0,0 +1,80 @@
<?php
/**
* Jetpack Compatibility File
*
* @link https://jetpack.com/
*
* @package Yuzu
*/
/**
* Jetpack setup function.
*
* See: https://jetpack.com/support/infinite-scroll/
* See: https://jetpack.com/support/responsive-videos/
* See: https://jetpack.com/support/content-options/
*/
function yuzu_jetpack_setup() {
// Add theme support for Infinite Scroll.
add_theme_support( 'infinite-scroll', array(
'container' => 'articles-list',
'posts_per_page' => 6,
'render' => 'yuzu_infinite_scroll_render',
'footer' => 'page',
) );
// Add theme support for Responsive Videos.
add_theme_support( 'jetpack-responsive-videos' );
// Add theme support for Content Options.
add_theme_support( 'jetpack-content-options', array(
'featured-images' => array(
'archive' => true,
'post' => true,
'page' => true,
),
) );
}
add_action( 'after_setup_theme', 'yuzu_jetpack_setup' );
/**
* Custom render function for Infinite Scroll.
*/
function yuzu_infinite_scroll_render() {
$count = 0;
while ( have_posts() ) {
the_post();
switch($count) {
case 0:
echo '<div class="row">';
require get_template_directory() . '/components/article-cards/large-article-card.php';
echo '</div>';
$count++;
break;
case 1:
echo '<div class="row">';
require get_template_directory() . '/components/article-cards/medium-article-card.php';
$count++;
break;
case 2:
require get_template_directory() . '/components/article-cards/medium-article-card.php';
echo '</div>';
$count++;
break;
case 3:
echo '<div class="row">';
require get_template_directory() . '/components/article-cards/small-article-card.php';
$count++;
break;
case 4:
require get_template_directory() . '/components/article-cards/small-article-card.php';
$count++;
break;
case 5:
require get_template_directory() . '/components/article-cards/small-article-card.php';
echo '</div>';
$count = 0;
break;
}
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* Filters to override default outputs in the Photography Core
*/
/**
* Collections Blocks
*/
function yuzu_mwt_collections_output( $html, $collections ) {
$output = "<div class='collections-list'>";
foreach( $collections as $collection ) {
ob_start();
require(locate_template('components/collection-card.php'));
$output .= ob_get_clean();
}
$output .= "</div>";
return $output;
}
add_filter( 'mwt_collections_output', 'yuzu_mwt_collections_output', 10, 2 );
function yuzu_mwt_folders_output( $html, $folders ) {
$output = "<div class='folders-list'>";
foreach( $folders as $folder ) {
ob_start();
require(locate_template('components/folder-card.php'));
$output .= ob_get_clean();
}
$output .= "</div>";
return $output;
}
add_filter( 'mwt_folders_output', 'yuzu_mwt_folders_output', 10, 2 );

View File

@@ -0,0 +1,37 @@
<?php
/**
* Functions which enhance the theme by hooking into WordPress
*
* @package Yuzu
*/
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function yuzu_body_classes( $classes ) {
// Adds a class of hfeed to non-singular pages.
if ( ! is_singular() ) {
$classes[] = 'hfeed';
}
// Adds a class of no-sidebar when there is no sidebar present.
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
$classes[] = 'no-sidebar';
}
return $classes;
}
add_filter( 'body_class', 'yuzu_body_classes' );
/**
* Add a pingback url auto-discovery header for single posts, pages, or attachments.
*/
function yuzu_pingback_header() {
if ( is_singular() && pings_open() ) {
printf( '<link rel="pingback" href="%s">', esc_url( get_bloginfo( 'pingback_url' ) ) );
}
}
add_action( 'wp_head', 'yuzu_pingback_header' );

148
inc/template-tags.php Normal file
View File

@@ -0,0 +1,148 @@
<?php
/**
* Custom template tags for this theme
*
* Eventually, some of the functionality here could be replaced by core features.
*
* @package Yuzu
*/
if ( ! function_exists( 'yuzu_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time.
*/
function yuzu_posted_on() {
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( DATE_W3C ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( DATE_W3C ) ),
esc_html( get_the_modified_date() )
);
$posted_on = sprintf(
/* translators: %s: post date. */
esc_html_x( 'Posted on %s', 'post date', 'yuzu' ),
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
);
echo '<span class="posted-on">' . $posted_on . '</span>'; // WPCS: XSS OK.
}
endif;
if ( ! function_exists( 'yuzu_posted_by' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function yuzu_posted_by() {
$byline = sprintf(
/* translators: %s: post author. */
esc_html_x( 'by %s', 'post author', 'yuzu' ),
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
);
echo '<span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
}
endif;
if ( ! function_exists( 'yuzu_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function yuzu_entry_footer() {
// Hide category and tag text for pages.
if ( 'post' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ', ', 'yuzu' ) );
if ( $categories_list ) {
/* translators: 1: list of categories. */
printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'yuzu' ) . '</span>', $categories_list ); // WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'yuzu' ) );
if ( $tags_list ) {
/* translators: 1: list of tags. */
printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'yuzu' ) . '</span>', $tags_list ); // WPCS: XSS OK.
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '<span class="comments-link">';
comments_popup_link(
sprintf(
wp_kses(
/* translators: %s: post title */
__( 'Leave a Comment<span class="screen-reader-text"> on %s</span>', 'yuzu' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
)
);
echo '</span>';
}
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit <span class="screen-reader-text">%s</span>', 'yuzu' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
),
'<span class="edit-link">',
'</span>'
);
}
endif;
if ( ! function_exists( 'yuzu_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*/
function yuzu_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>
<div class="post-thumbnail">
<?php the_post_thumbnail(); ?>
</div><!-- .post-thumbnail -->
<?php else : ?>
<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
<?php
the_post_thumbnail( 'post-thumbnail', array(
'alt' => the_title_attribute( array(
'echo' => false,
) ),
) );
?>
</a>
<?php
endif; // End is_singular().
}
endif;