diff --git a/includes/admin/admin.php b/includes/admin/admin.php index b6b7d14..0dee9e2 100644 --- a/includes/admin/admin.php +++ b/includes/admin/admin.php @@ -39,6 +39,7 @@ function trestle_custom_defaults( $defaults ) { 'trestle_layout' => 'solid', 'trestle_logo_url' => '', 'trestle_logo_url_mobile' => '', + 'trestle_favicon_url' => '', 'trestle_nav_primary_location' => 'full', 'trestle_auto_nav' => 0, 'trestle_auto_nav_depth' => 0, @@ -123,6 +124,7 @@ function trestle_register_social_sanitization_filters() { array( 'trestle_logo_url', 'trestle_logo_url_mobile', + 'trestle_favicon_url', 'trestle_home_link_text', 'trestle_nav_button_text', 'trestle_custom_nav_extras_text', @@ -167,7 +169,7 @@ function trestle_settings_box() { />

-

+


@@ -176,6 +178,11 @@ function trestle_settings_box() {

+

+
+ + /wp-content/themes/trestle/images/favicon.ico if not specified.', 'trestle' ); ?> +

diff --git a/includes/functions/theme-functions.php b/includes/functions/theme-functions.php index ea71f76..5f4ddfd 100644 --- a/includes/functions/theme-functions.php +++ b/includes/functions/theme-functions.php @@ -10,7 +10,7 @@ */ /*=========================================== - * Head Styles & Scripts + * Header ===========================================*/ add_action( 'wp_enqueue_scripts', 'trestle_header_actions' ); @@ -50,6 +50,20 @@ function trestle_header_actions() { } +add_filter( 'genesis_pre_load_favicon', 'trestle_do_custom_favicon' ); +/** + * Output custom favicon if specified in the theme options. + * + * @since 1.0.0 + * + * @param string $favicon_url Default favicon URL. + * + * @return string Custom favicon URL (if specified), or the default URL. + */ +function trestle_do_custom_favicon( $favicon_url ) { + return genesis_get_option( 'trestle_favicon_url' ) ? genesis_get_option( 'trestle_favicon_url' ) : $favicon_url; +} + /*=========================================== * Body Classes ===========================================*/ @@ -420,8 +434,9 @@ function trestle_read_more_link( $default_text ) { // Get Trestle custom "read more" link text $custom_text = esc_attr( genesis_get_option( 'trestle_read_more_text' ) ); - if ( $custom_text ) + if ( $custom_text ) { return '… ' . $custom_text . ''; - else + } else { return $default_text; + } }