diff --git a/.jshintignore b/.jshintignore index dca3507..5ed67ca 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1 +1,2 @@ js/bootstrap.min.js +js/bootstrap.js diff --git a/css/admin-style.css b/css/admin-style.css index b18eec2..ce8aa09 100644 --- a/css/admin-style.css +++ b/css/admin-style.css @@ -245,4 +245,37 @@ button.zillah_general_control_remove_field:hover{ .zillah_pallete_default { line-height: 40px; cursor: pointer; -} \ No newline at end of file +} + +/***********************************/ +/****** Google fonts Control *******/ +/***********************************/ +.ti-google-fonts-wrap { + background: rgba(255, 255, 255, 0.75); + padding: 10px; + border: 1px solid #ddd; + max-height: 140px; + overflow-y: auto; + overflow-x: auto; +} + +.ti-google-fonts-wrap label { + width: 100%; + display: block; + clear: left; + font-size: 16px; + line-height: 28px; + overflow: hidden; + position: relative; +} + +.ti-google-fonts-wrap label input { + position: absolute; + left: -9999px; +} + +.ti-google-fonts-wrap label:hover, +.ti-google-fonts-wrap label.ti-google-fonts-active { + color: #0073aa; +} + diff --git a/functions.php b/functions.php index 7b5b658..3b84b2e 100644 --- a/functions.php +++ b/functions.php @@ -69,11 +69,15 @@ function zillah_setup() { * See https://developer.wordpress.org/themes/functionality/post-formats/ */ add_theme_support( 'post-formats', array( -// 'aside', -// 'image', -// 'video', -// 'quote', -// 'link', + 'aside', + 'image', + 'video', + 'quote', + 'link', + 'gallery', + 'status', + 'audio', + 'chat', ) ); // Set up the WordPress core custom background feature. @@ -84,8 +88,8 @@ function zillah_setup() { // Add theme support for custom logo add_theme_support( 'custom-logo', array( - 'height' => 145, - 'width' => 315, + 'height' => 290, + 'width' => 630, 'flex-width' => true, ) ); } @@ -234,7 +238,7 @@ function zillah_scripts() { function zillah_customizer_script() { wp_enqueue_style( 'zillah-font-awesome-admin', get_template_directory_uri() . '/css/font-awesome.min.css', array(), 'v4.5.0', false ); wp_enqueue_script( 'zillah-customizer-script', get_template_directory_uri() .'/js/zillah-customizer.js', array( 'jquery' ), '1.0.1', true ); - wp_enqueue_style( 'zillah-admin-stylesheet', get_stylesheet_directory_uri().'/css/admin-style.css','1.0.0' ); + wp_enqueue_style( 'zillah-admin-stylesheet', get_template_directory_uri() .'/css/admin-style.css','1.0.0' ); } add_action( 'customize_controls_enqueue_scripts', 'zillah_customizer_script' ); @@ -314,6 +318,11 @@ function zillah_brand(){ if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); + } else { + $zillah_logo_old = get_theme_mod( 'zillah_logo_old', false ); + echo ''; } if( ( ! $zillah_tagline_hide && display_header_text() ) || is_customize_preview() ) { @@ -477,129 +486,154 @@ function zillah_php_style() { $header_text_color = get_header_textcolor(); + $zillah_first_font_one = get_theme_mod( 'zillah_google_fonts_one' ); + $zillah_first_font_two = get_theme_mod( 'zillah_google_fonts_two' ); + + if( !empty($zillah_first_font_one) ) { + $zillah_first_font_one = explode( '|', $zillah_first_font_one ); + } + if( !empty($zillah_first_font_two) ) { + $zillah_first_font_two = explode( '|', $zillah_first_font_two ); + } + + $zillah_font_size = get_theme_mod( 'zillah_select_box_font_size', '16px' ); + if( isset( $zillah_c5 ) ) { $rgb = zillah_get_rgb( $zillah_c5 ); } echo ''; } @@ -649,24 +747,47 @@ function custom_excerpt_length( $length ) { } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); +/* Post thumbnail */ +function zillah_post_thumbnail() { + $post_format = get_post_format(); + if ( has_post_thumbnail() ) { + echo '
'; + echo ''; + the_post_thumbnail(); + echo ''; + echo '
'; + } else { + $post_image_link = zillah_catch_that_image(); + $zillah_image_as_thumbnail = get_theme_mod( 'zillah_image_as_thumbnail', false ); + if( $post_image_link && $zillah_image_as_thumbnail ) { + echo '
'; + echo ''; + echo ''. esc_attr( get_the_title() ) .''; + echo ''; + echo '
'; + } + } +} + +/* Post image */ function zillah_post_image() { if ( has_post_thumbnail() ) { echo '
'; the_post_thumbnail(); - echo '
'; + echo ''; } else { $post_image_link = zillah_catch_that_image(); - $zillah_image_as_thumbnail = get_theme_mod( 'zillah_image_as_thumbnail', false ); - if( $post_image_link && $zillah_image_as_thumbnail ) { + if( $post_image_link ) { echo '
'; echo ''. esc_attr( get_the_title() ) .''; - echo '
'; + echo ''; } } } +/* Get the first image from post */ function zillah_catch_that_image() { global $post, $posts; $first_img = false; @@ -676,3 +797,90 @@ function zillah_catch_that_image() { $first_img = ! empty( $matches[1][0] ) ? $matches[1][0] : false; return $first_img; } + + +/* Get first embed media */ +function zillah_get_first_embed_media($post_id) { + $post = get_post($post_id); + $content = do_shortcode( apply_filters( 'the_content', $post->post_content ) ); + $embeds = get_media_embedded_in_content( $content ); + if( !empty($embeds) ) { + //check what is the first embed containg video tag, youtube or vimeo + foreach( $embeds as $embed ) { + if( strpos( $embed, 'video' ) || strpos( $embed, 'youtube' ) || strpos( $embed, 'vimeo' ) ) { + return $embed; + } + } + } else { + //No video embedded found + return false; + } +} + + +/* Get gallery */ +function zillah_post_gallery() { + + if ( get_post_gallery() ) : + $gallery = get_post_gallery( get_the_ID(), false ); + + if( isset( $gallery['ids'] ) ) { + $ids = explode( ",", $gallery['ids'] ); + } else { + return false; + } + + if ( $ids ) { + echo '
+
+ +
'; + } else { + if ( has_post_thumbnail() ) { + echo '
'; + the_post_thumbnail(); + echo '
'; + } + } + endif; + +} + + +/* Post video */ +function zillah_post_video() { + + $zillah_video = zillah_get_first_embed_media( get_the_ID() ); + if( $zillah_video || has_post_thumbnail() ) { + echo '
'; + if( $zillah_video ) { + echo $zillah_video; + } else if( has_post_thumbnail() ) { + echo '
'; + the_post_thumbnail(); + echo '
'; + } + echo '
'; + } + +} + diff --git a/inc/class/zillah-google-fonts.php b/inc/class/zillah-google-fonts.php new file mode 100644 index 0000000..bb7ccdc --- /dev/null +++ b/inc/class/zillah-google-fonts.php @@ -0,0 +1,42 @@ +options = $args; + $this->control_id = $id; + } + + public function render_content() { + $options = $this->options; + $control_id = $this->control_id; + + $ti_google_fonts = ''; + foreach( $options['ti_google_fonts'] as $zilla_font ) { + $ti_input_value = implode( '|', $zilla_font); + $ti_google_fonts .= ''; + } + + // Hackily add in the data link parameter. + $ti_google_fonts = str_replace( 'get_link(), $ti_google_fonts ); + + printf( + '
%s
%s
', + $this->label, + $ti_google_fonts + ); + + } + + } +} +?> \ No newline at end of file diff --git a/inc/customizer.php b/inc/customizer.php index daef8a0..23e7119 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -17,6 +17,7 @@ function zillah_customize_register( $wp_customize ) { $wp_customize->get_setting( 'header_textcolor' )->default = '#7fcaad'; require_once ( 'class/zillah_category-selector-control.php'); + require_once ( 'class/zillah-google-fonts.php'); $wp_customize->get_control( 'blogname' )->priority = 3; $wp_customize->get_control( 'blogdescription' )->priority = 4; @@ -55,7 +56,7 @@ function zillah_customize_register( $wp_customize ) { $wp_customize->add_control('zillah_sidebar_show', array( 'label' => esc_html__('Show sidebar', 'zillah'), - 'description' => esc_html__('If you check this box, the sidebar will appear.', 'zillah'), + 'description' => esc_html__('If you check this box, the sidebar will appear on homepage and archive page.', 'zillah'), 'section' => 'zillah_home_theme_option_section', 'priority' => 1, 'type' => 'checkbox', @@ -133,6 +134,113 @@ function zillah_customize_register( $wp_customize ) { 'metro_customizr_link_control' => true ) ) ); + /* Google fonts */ + $wp_customize->add_setting('zillah_google_fonts_one', array( + 'default' => 0, + 'sanitize_callback' => 'sanitize_text_field', + )); + + $wp_customize->add_control( new Zillah_Google_Fonts_Control( $wp_customize, 'zillah_google_fonts_one', array( + 'label' => 'Select first font family ( content )', + 'section' => 'zillah_home_theme_option_section', + 'priority' => 4, + 'ti_google_fonts' => array( + array( + 'font_family' => 'Merriweather', + 'type' => 'serif', + 'subset' => '400', + ), + array( + 'font_family'=>'Open Sans', + 'type' => 'sans-serif', + 'subset'=>'400', + ), + array( + 'font_family'=>'Josefin Slab', + 'type' => 'serif', + 'subset'=>'400', + ), + array( + 'font_family'=>'Ubuntu', + 'type' => 'sans-serif', + 'subset'=>'400', + ), + array( + 'font_family'=>'Vollkorn', + 'type' => 'serif', + 'subset'=>'400', + ), + ), + ))); + + $wp_customize->add_setting('zillah_google_fonts_two', array( + 'default' => 0, + 'sanitize_callback' => 'sanitize_text_field', + )); + + $wp_customize->add_control( new Zillah_Google_Fonts_Control( $wp_customize, 'zillah_google_fonts_two', array( + 'label' => 'Select second font family ( headings )', + 'section' => 'zillah_home_theme_option_section', + 'priority' => 5, + 'ti_google_fonts' => array( + array( + 'font_family'=>'Cabin', + 'type' => 'sans-serif', + 'subset'=>'400', + ), + array( + 'font_family'=>'Lato', + 'type' => 'sans-serif', + 'subset'=>'400', + ), + array( + 'font_family' => 'Arvo', + 'type' => 'serif', + 'subset'=>'400', + ), + array( + 'font_family'=>'Open Sans', + 'type' => 'sans-serif', + 'subset'=>'400', + ), + array( + 'font_family'=>'Ubuntu', + 'type' => 'sans-serif', + 'subset'=>'400', + ), + ), + ))); + + /* Font size */ + $wp_customize->add_setting('zillah_select_box_font_size', array( + 'default' => '16px', + )); + + $wp_customize->add_control( 'zillah_select_box_font_size', array( + 'label' => 'Select Font Size:', + 'section' => 'zillah_home_theme_option_section', + 'priority' => 6, + 'type' => 'select', + 'choices' => array( + '14px' => 'Small', + '16px' => 'Medium', + '18px' => 'Large', + ), + )); + + if( ! $custom_logo ) { + + $wp_customize->add_setting( 'zillah_logo_old' ); + + $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'zillah_logo_old', array( + 'label' => __( 'Logo', 'zillah' ), + 'section' => 'title_tagline', + 'settings' => 'zillah_logo_old', + ) ) ); + + } + + } add_action( 'customize_register', 'zillah_customize_register' ); diff --git a/js/customizer.js b/js/customizer.js index ef15321..be07cbb 100644 --- a/js/customizer.js +++ b/js/customizer.js @@ -44,7 +44,7 @@ // Hide Site Title wp.customize( 'zillah_tagline_show', function( value ) { value.bind( function( to ) { - if( to != '' ) { + if( to !== '' ) { $( '.header-title-wrap' ).addClass( 'zillah-only-customizer' ); } else { @@ -57,7 +57,7 @@ // Logo wp.customize( 'custom_logo', function( value ) { value.bind( function( to ) { - if( to != '' ) { + if( to !== '' ) { $( '.custom-logo-link' ).removeClass( 'zillah-only-customizer' ); $( '.header-title-wrap' ).addClass( 'zillah-only-customizer' ); } @@ -71,7 +71,7 @@ // Slider wp.customize( 'zillah_home_slider_show', function( value ) { value.bind( function( to ) { - if( to != '' ) { + if( to !== '' ) { $( '#home-carousel' ).removeClass( 'zillah-only-customizer' ); } else { @@ -83,7 +83,7 @@ // Slider wp.customize( 'zillah_tags_show', function( value ) { value.bind( function( to ) { - if( to != '' ) { + if( to !== '' ) { $( '.tags-links' ).removeClass( 'zillah-only-customizer' ); } else { @@ -93,10 +93,10 @@ } ); // Social repeater - wp.customize( "zillah_social_icons", function( value ) { + wp.customize( 'zillah_social_icons', function( value ) { value.bind( function( to ) { var obj = JSON.parse( to ); - var result =""; + var result = ''; var lastIcon = $( '.social-media-icons li:last-child' ); @@ -104,20 +104,18 @@ result+= '
  • '; }); - if ( ! lastIcon.hasClass("zillah-only-customizer") ){ + if ( ! lastIcon.hasClass('zillah-only-customizer') ){ result+= '
  • '; } else { result+= '
  • '; } $( '.social-media-icons' ).html( result ); - zillah_header_social_icons_width(); - zillah_menu_toggle_height(); } ); } ); // Page header image - wp.customize( "zillah_page_header", function( value ) { + wp.customize( 'zillah_page_header', function( value ) { value.bind( function( to ) { $('.page-main-header').css('background-image','url("'+ to +'")'); } ); @@ -127,7 +125,7 @@ // Sidebar wp.customize( 'zillah_sidebar_show', function( value ) { value.bind( function( to ) { - if( to != '' ) { + if( to !== '' ) { $( '#secondary' ).removeClass( 'zillah-only-customizer' ); $( '.content-area' ).addClass( 'content-area-with-sidebar' ); } diff --git a/js/functions.js b/js/functions.js index 2eb9d13..3acd5aa 100644 --- a/js/functions.js +++ b/js/functions.js @@ -99,7 +99,10 @@ //ACCESSIBILITY MENU ( function( $ ) { + /* global screenReaderText */ + function initMainNavigation( container ) { + // Add dropdown toggle that display child menu items. container.find( '.menu-item-has-children > a' ).after( '' ); @@ -188,7 +191,13 @@ } $( document ).ready( function() { - $( window ).on( 'load.parallax-one', onResizeARIA ) + $( window ).on( 'load.parallax-one', onResizeARIA ); + + + $( '#carousel-post-gallery' ).carousel({ + interval: 2000 + }); + } ); @@ -202,7 +211,7 @@ var headerHeight, isAdminBar, lastScrollTop = 0, - initTop = 0; + initTop = 0, changeDirection = false, lastDirectionDown = false; var $headerToHide = $( '.header-inner-top' ), @@ -224,7 +233,7 @@ $body.css( 'padding-top', window.innerWidth > 992 ? headerHeight : 0 ); }); - $(window).scroll(function (event) { + $(window).scroll(function () { var thisScrollTop = $(this).scrollTop(); changeDirection = ( thisScrollTop > headerHeight && (thisScrollTop > lastScrollTop && lastDirectionDown === false) || (thisScrollTop < lastScrollTop && lastDirectionDown === true) ? true : false ); if (changeDirection === true) { diff --git a/js/zillah-customizer.js b/js/zillah-customizer.js index 778fef4..1422014 100644 --- a/js/zillah-customizer.js +++ b/js/zillah-customizer.js @@ -23,11 +23,10 @@ jQuery(document).ready(function () { jQuery('.zillah_palette_input').html(metro_palette); - jQuery('.zillah_palette_input span').each(function (index) { + jQuery('.zillah_palette_input span').each(function () { it++; - var colnb = 'color' + it; var colval = jQuery(this).css('background-color'); - values["color" + it] = colval; + values['color' + it] = colval; }); th.parent().parent().find('.zillah_palette_colector').val(JSON.stringify(values)); th.parent().parent().find('.zillah_palette_colector').trigger('change'); @@ -38,4 +37,16 @@ jQuery(document).ready(function () { th.parent().parent().find('.zillah_palette_colector').trigger('change'); } }); -}); \ No newline at end of file +}); + + + +jQuery( document ).ready( function() { + + jQuery( '.ti-google-fonts input:radio:checked' ).parent( 'label' ).addClass( 'ti-google-fonts-active' ); + jQuery( '.ti-google-fonts input' ).click( function() { + jQuery( this ).parent().parent().find( '.ti-google-fonts-active' ).removeClass( 'ti-google-fonts-active' ); + jQuery( this ).parent().addClass( 'ti-google-fonts-active' ); + }); + +}); diff --git a/style.css b/style.css index 99151b0..e9eec06 100644 --- a/style.css +++ b/style.css @@ -4,7 +4,7 @@ Theme URI: http://themeisle.com/themes/zillah/ Author: ThemeIsle Author URI: http://themeisle.com Description: Zillah is a free blogging WordPress theme. -Version: 1.0.6 +Version: 1.0.7 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: zillah @@ -380,6 +380,13 @@ blockquote { margin: 50px 0; } +.entry-content a img, +.entry-summary a img, +.comment-content a img, +.textwidget a img { + display: block; +} + address { margin: 0 0 1.5em; } @@ -994,6 +1001,22 @@ a:active { margin-right: 35px; } +/*-------------------------------------------------------------- +# Post format +--------------------------------------------------------------*/ +/* quote */ +.post_format-post-format-quote .content-inner-wrap p { + margin-bottom: 0; + } + +.post_format-post-format-quote blockquote { + margin: 0; +} + +.post_format-post-format-quote .post-thumbnail { + margin-top: -45px; +} + /*-------------------------------------------------------------- # Accessibility --------------------------------------------------------------*/ @@ -1317,7 +1340,7 @@ p.dropcap:first-letter { ## Blog --------------------------------------------------------------*/ .post-thumbnail { - display: inline-block; + display: block; } .post-thumbnail-wrap { @@ -1326,8 +1349,16 @@ p.dropcap:first-letter { margin-bottom: 50px; } +.post-thumbnail-wrap iframe { + width: 100%; +} + +#carousel-post-gallery img { + width: 100%; +} + .post-thumbnail-wrap img { - max-height: 438px; + width: 100%; } .entry-title-blog { @@ -1926,6 +1957,11 @@ object { line-height: 20px; } +.header-logo-wrap img { + max-height: 145px; + width: auto; +} + .social-navigation a[href*="twitter.com"]::before { content: '\f099'; } @@ -3024,6 +3060,7 @@ div.sharedaddy h3.sd-title:before { .carousel-caption-category { margin: 0; padding: 0; + color: #aaaaaa; } .carousel-caption-category a { @@ -3111,10 +3148,6 @@ div.sharedaddy h3.sd-title:before { max-width: 840px; } - .post-thumbnail-wrap img { - max-height: 545px; - } - } diff --git a/template-parts/content-single.php b/template-parts/content-single.php index 0e14551..662bb31 100644 --- a/template-parts/content-single.php +++ b/template-parts/content-single.php @@ -56,15 +56,19 @@ -
    -
    -
    - -
    - '; + echo '
    '; + + echo '
    '; + echo get_avatar( get_the_author_meta( 'user_email' ), '100' ); + echo '
    '; $author_name = ''; if ( ! empty( $author_first_name ) ) { @@ -79,13 +83,14 @@ echo '' . $author_name . ''; } echo '
    '; - } - - $author_description = wp_kses_post( nl2br( get_the_author_meta('description') ) ); - if( !empty( $author_description ) ){ - echo '
    ' . $author_description . '
    '; - } - ?> - -
    -
    \ No newline at end of file + + if( !empty( $author_description ) ){ + echo '
    ' . $author_description . '
    '; + } + + echo '
    '; + echo ''; + + } +?> + diff --git a/template-parts/content.php b/template-parts/content.php index a7e811c..5145764 100644 --- a/template-parts/content.php +++ b/template-parts/content.php @@ -7,40 +7,56 @@ * @package zillah */ + + $post_format = get_post_format(); ?>
    > -
    -
    - ', '' ); - zillah_category(); - ?> -
    -
    + +
    +
    + ', '' ); + zillah_category(); + ?> +
    +
    +
    post_content, '' ); - if ( $pos <= 0 ) { - the_excerpt(); + if ( $post_format === 'quote' || $post_format === 'aside' || $post_format === 'audio' || $post_format === 'chat' || $post_format === 'link' || $post_format === 'status' ) { + the_content(); } else { - the_content( false ); - echo zillah_read_more_link(); - } + $pos = strpos( $post->post_content, '' ); + if ( $pos <= 0 ) { + the_excerpt(); + } else { + the_content( false ); + echo zillah_read_more_link(); + } - wp_link_pages( array( - 'before' => '', - ) ); + wp_link_pages( array( + 'before' => '', + ) ); + } ?>