diff --git a/functions.php b/functions.php index 3100225..bc1e7fa 100644 --- a/functions.php +++ b/functions.php @@ -58,16 +58,31 @@ function trestle_theme_setup() { /*=========================================== - * Header Styles & Scripts + * Widget Areas + ===========================================*/ + + add_action( 'widgets_init', 'trestle_register_widget_areas' ); + + + /*=========================================== + * Head Styles & Scripts ===========================================*/ add_action( 'wp_enqueue_scripts', 'trestle_header_actions' ); /*=========================================== - * Widget Areas + * Body Classes ===========================================*/ - - add_action( 'widgets_init', 'trestle_register_widget_areas' ); + + add_filter( 'body_class', 'trestle_body_classes' ); + + /*=========================================== + * Header + ===========================================*/ + + // Add logo + add_filter( 'genesis_seo_title', 'trestle_do_logos', 10, 3 ); + /*=========================================== * Auto & Mobile Navigation @@ -95,9 +110,6 @@ function trestle_theme_setup() { * General Actions & Filters ===========================================*/ - // Add body classes - add_filter( 'body_class', 'trestle_body_classes' ); - // Do custom Read More text add_filter( 'excerpt_more', 'trestle_read_more_link' ); add_filter( 'get_the_content_more_link', 'trestle_read_more_link' ); diff --git a/lib/admin/admin-functions.php b/lib/admin/admin-functions.php index b6b67b2..2337d31 100644 --- a/lib/admin/admin-functions.php +++ b/lib/admin/admin-functions.php @@ -113,6 +113,8 @@ function trestle_register_social_sanitization_filters() { 'safe_html', GENESIS_SETTINGS_FIELD, array( + 'trestle_logo_url', + 'trestle_logo_url_mobile', 'trestle_home_link_text', 'trestle_nav_button_text', 'trestle_custom_nav_extras_text', @@ -155,6 +157,16 @@ function trestle_settings_box() { /> />

+ +

+

+
+ +

+

+
+ +

diff --git a/lib/admin/editor-style.css b/lib/admin/editor-style.css index 66152e1..4d17d21 100644 --- a/lib/admin/editor-style.css +++ b/lib/admin/editor-style.css @@ -11,7 +11,9 @@ /* Overrides --------------------------------------------- */ body { + padding: 8px 16px; background-color: #FFF; + background-image: none; } .content { diff --git a/lib/functions/theme-functions.php b/lib/functions/theme-functions.php index c55f516..a7a4108 100644 --- a/lib/functions/theme-functions.php +++ b/lib/functions/theme-functions.php @@ -10,7 +10,20 @@ */ /*=========================================== - * Header Styles & Scripts + * Widget Areas +===========================================*/ + +/** + * Register custom widget areas + * + * @since 1.0.0 + */ +function trestle_register_widget_areas() { + +} + +/*=========================================== + * Head Styles & Scripts ===========================================*/ /** @@ -44,16 +57,112 @@ function trestle_header_actions() { /*=========================================== - * Widget Areas + * Body Classes ===========================================*/ /** - * Register custom widget areas + * Adds custom classes to the element for styling purposes. + * + * @since 1.0.0 + * + * @param array $classes Body classes. + * @return array Updated body classes. + */ +function trestle_body_classes( $classes ) { + // Add 'no-jquery' class to be removed by jQuery if enabled + $classes[] = 'no-jquery'; + + // Add 'bubble' class + if ( 'bubble' == genesis_get_option( 'trestle_layout' ) ) + $classes[] = 'bubble'; + + // Add link icon classes + if ( genesis_get_option( 'trestle_external_link_icons' ) ) + $classes[] = 'external-link-icons'; + if ( genesis_get_option( 'trestle_email_link_icons' ) ) + $classes[] = 'email-link-icons'; + if ( genesis_get_option( 'trestle_pdf_link_icons' ) ) + $classes[] = 'pdf-link-icons'; + if ( genesis_get_option( 'trestle_doc_link_icons' ) ) + $classes[] = 'doc-link-icons'; + + // Add footer widget number class + if ( genesis_get_option( 'trestle_footer_widgets_number' ) ) + $classes[] = 'footer-widgets-number-' . esc_attr( genesis_get_option( 'trestle_footer_widgets_number' ) ); + + // Add class for equal height Genesis Extender columns + if ( 1 == genesis_get_option( 'trestle_equal_height_cols' ) ) + $classes[] = 'equal-height-genesis-extender-cols'; + + // Add logo class + if ( genesis_get_option( 'trestle_logo_url' ) || genesis_get_option( 'trestle_logo_url_mobile' ) ) + $classes[] = 'has-logo'; + + return $classes; +} + +/*=========================================== + * Header +===========================================*/ + +/** + * Output logos. * * @since 1.0.0 */ -function trestle_register_widget_areas() { +function trestle_do_logos( $title, $inside, $wrap ) { + $logo_url = genesis_get_option( 'trestle_logo_url' ); + $logo_url_mobile = genesis_get_option( 'trestle_logo_url_mobile' ); + $logo_html = ''; + // Regular logo + if ( $logo_url ) { + + // Default logo class + $classes = array('logo'); + + // If no mobile logo is specified, make regular logo act as mobile logo too + if( ! $logo_url_mobile ) + $classes[] = 'logo-show'; + + $logo_html .= sprintf( '%s', + implode(' ', $classes), + esc_attr( get_bloginfo( 'name' ) ), + $logo_url + ); + } + + // Mobile logo + if ( $logo_url_mobile ) { + + // Default mobile logo class + $classes = array('logo-mobile'); + + // If no regular logo is specified, make mobile logo act as regular logo too + if( ! $logo_url ) + $classes[] = 'logo-show'; + + $logo_html .= sprintf( '%s', + implode(' ', $classes), + esc_attr( get_bloginfo( 'name' ) ), + $logo_url_mobile + ); + } + + if ( $logo_html ) { + $inside .= sprintf( '%s', + trailingslashit( home_url() ), + esc_attr( get_bloginfo( 'name' ) ), + $logo_html + ); + } + + //* Build the title + $title = genesis_html5() ? sprintf( "<{$wrap} %s>", genesis_attr( 'site-title' ) ) : sprintf( '<%s id="title">%s', $wrap, $inside, $wrap ); + $title .= genesis_html5() ? "{$inside}" : ''; + + //* Echo (filtered) + return $title; } @@ -294,43 +403,6 @@ function trestle_featured_image_fallback( $args ) { * General Actions & Filters ===========================================*/ -/** - * Adds custom classes to the element for styling purposes. - * - * @since 1.0.0 - * - * @param array $classes Body classes. - * @return array Updated body classes. - */ -function trestle_body_classes( $classes ) { - // Add 'no-jquery' class to be removed by jQuery if enabled - $classes[] = 'no-jquery'; - - // Add 'bubble' class - if ( 'bubble' == genesis_get_option( 'trestle_layout' ) ) - $classes[] = 'bubble'; - - // Add link icon classes - if ( genesis_get_option( 'trestle_external_link_icons' ) ) - $classes[] = 'external-link-icons'; - if ( genesis_get_option( 'trestle_email_link_icons' ) ) - $classes[] = 'email-link-icons'; - if ( genesis_get_option( 'trestle_pdf_link_icons' ) ) - $classes[] = 'pdf-link-icons'; - if ( genesis_get_option( 'trestle_doc_link_icons' ) ) - $classes[] = 'doc-link-icons'; - - // Add footer widget number class - if ( genesis_get_option( 'trestle_footer_widgets_number' ) ) - $classes[] = 'footer-widgets-number-' . esc_attr( genesis_get_option( 'trestle_footer_widgets_number' ) ); - - // Add class for equal height Genesis Extender columns - if ( 1 == genesis_get_option( 'trestle_equal_height_cols' ) ) - $classes[] = 'equal-height-genesis-extender-cols'; - - return $classes; -} - /** * Resets post type back to page once post info / meta functionality is done. * diff --git a/style.css b/style.css index 6df99e2..c12e863 100644 --- a/style.css +++ b/style.css @@ -1264,10 +1264,6 @@ Site Header text-align: center; } -.header-image .title-area { - padding: 0; -} - .site-title { font-size: 28px; font-size: 2.8rem; @@ -1291,6 +1287,12 @@ Site Header margin-bottom: 0; } +.has-logo .site-title a:first-child { + position: absolute; + left: -9999px; + top: -9999px; +} + /* Full width header, no widgets */ .header-full-width .title-area, @@ -1298,25 +1300,17 @@ Site Header width: 100%; } -.header-image .site-description, -.header-image .site-title a { - display: block; - text-indent: -9999px; +/* Logo +--------------------------------------------- */ + +.logo { + display: none; } -/* Logo, hide text */ - -.header-image .site-header .wrap { - background: url(images/logo.png) no-repeat; - background-position: center top; - padding: 0; +.logo-show { + display: inline-block !important; } -.header-image .site-title a { - float: left; - min-height: 164px; - width: 100%; -} /* Widget Area --------------------------------------------- */ @@ -2012,14 +2006,22 @@ Media Queries /* Header --------------------------------------------- */ + .header-image .site-header .wrap { + background-position: left top; + } + .title-area { width: auto; margin-bottom: 0; text-align: left; } - .header-image .site-header .wrap { - background-position: left top; + .logo-mobile { + display: none; + } + + .logo { + display: inline-block; } .header-image .site-header .widget-area {