Added logo functionality!

This commit is contained in:
MickeyKay
2014-05-08 13:41:17 -07:00
parent e898968b18
commit 74fdbd7512
5 changed files with 169 additions and 69 deletions
+19 -7
View File
@@ -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' );
+12
View File
@@ -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() {
<img src="<?php echo $img_path; ?>icon-bubble.gif" width="200" height="160" <?php echo 'bubble' == genesis_get_option( 'trestle_layout' ) ? 'class="checked"' : '' ?> />
<input type="radio" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_layout]" value="bubble" <?php checked( esc_attr( genesis_get_option( 'trestle_layout' ) ), 'bubble' ); ?> />
</p>
<h4><?php _e( 'Header', 'trestle' ) ?></h4>
<p>
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url]"><?php _e( 'Logo URL', 'trestle' ); ?></label><br />
<input class="widefat" type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url]" value="<?php echo esc_attr( genesis_get_option( 'trestle_logo_url' ) ); ?>" />
</p>
<p>
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url_mobile]"><?php _e( 'Mobile Logo URL', 'trestle' ); ?></label><br />
<input class="widefat" type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url_mobile]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_logo_url_mobile]" value="<?php echo esc_attr( genesis_get_option( 'trestle_logo_url_mobile' ) ); ?>" />
</p>
<h4><?php _e( 'Primary Navigation', 'trestle' ) ?></h4>
<p>
+2
View File
@@ -11,7 +11,9 @@
/* Overrides
--------------------------------------------- */
body {
padding: 8px 16px;
background-color: #FFF;
background-image: none;
}
.content {
+113 -41
View File
@@ -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 <body> 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( '<img class="%s" alt="%s" src="%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( '<img class="%s" alt="%s" src="%s" />',
implode(' ', $classes),
esc_attr( get_bloginfo( 'name' ) ),
$logo_url_mobile
);
}
if ( $logo_html ) {
$inside .= sprintf( '<a href="%s" title="%s">%s</a>',
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</%s>', $wrap, $inside, $wrap );
$title .= genesis_html5() ? "{$inside}</{$wrap}>" : '';
//* Echo (filtered)
return $title;
}
@@ -294,43 +403,6 @@ function trestle_featured_image_fallback( $args ) {
* General Actions & Filters
===========================================*/
/**
* Adds custom classes to the <body> 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.
*
+23 -21
View File
@@ -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 {