Skip to content

Commit

Permalink
* Added sanity checks for WordPress 4.1 `add_theme_support( 'title-ta…
Browse files Browse the repository at this point in the history
…g' )`

* Added BNS Login compatibility to display dashicons instead of text links
  • Loading branch information
Cais committed Dec 27, 2014
1 parent f376227 commit 56492b2
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 25 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Expand Up @@ -4,10 +4,14 @@ Changelog: December 27, 2014
= Code =
* Additional minor code refactoring to better meet WordPress Coding Standards
* Added `nona_content_width` function to be used in `*_head` hooks
* Added sanity check for WordPress 4.1 `add_theme_support( 'title-tag' )`
* Removed call to unused `$wp_version` global in `nona_setup`

= CSS =


= Miscellaneous =
* Added BNS Login compatibility to display dashicons instead of text links
* Cleaned up theme description

/** ------------------------------------------------------------------------- */
Expand Down
62 changes: 42 additions & 20 deletions functions.php
Expand Up @@ -88,8 +88,9 @@ function nona_content_width() {
* @date July 10, 2012
* Removed deprecated function call to `add_custom_background`
*
* @version 1.9.2
* @date December 27, 2014
* @version 1.9.2
* @date December 27, 2014
* Added `title-tag` support
* Removed call to unused `$wp_version` global
*/
function nona_setup() {
Expand All @@ -109,6 +110,9 @@ function nona_setup() {
)
);

/** Add support for the `<title />` tag */
add_theme_support( 'title-tag' );

/** wp_nav_menu support */
if ( ! function_exists( 'nona_nav_menu' ) ) {
/**
Expand Down Expand Up @@ -436,31 +440,44 @@ function nona_widgets() {
* @version 1.9
* @date December 28, 2013
* Removed the unused variable `$sep_location`
*
* @version 1.9.2
* @date December 27, 2014
* Added sanity check for WordPress 4.1 `add_theme_support( 'title-tag' )`
*/
function nona_wp_title( $old_title, $sep ) {

global $page, $paged;
/** Set initial title text */
$nona_title_text = $old_title . get_bloginfo( 'name' );
/** Add wrapping spaces to separator character */
$sep = ' ' . $sep . ' ';
/** Sanity check for WordPress 4.1 `add_theme_support( 'title-tag' )` */
if ( ! function_exists( '_wp_render_title_tag' ) ) {

/** Add the blog description (tagline) for the home/front page */
$site_tagline = get_bloginfo( 'description', 'display' );
global $page, $paged;
/** Set initial title text */
$nona_title_text = $old_title . get_bloginfo( 'name' );
/** Add wrapping spaces to separator character */
$sep = ' ' . $sep . ' ';

if ( $site_tagline && ( is_home() || is_front_page() ) ) {
$nona_title_text .= "$sep$site_tagline";
}
/** End if - site tagline */
/** Add the blog description (tagline) for the home/front page */
$site_tagline = get_bloginfo( 'description', 'display' );

/** Add a page number if necessary */
if ( $paged >= 2 || $page >= 2 ) {
$nona_title_text .= $sep . sprintf( __( 'Page %s', 'nona' ), max( $paged, $page ) );
}
if ( $site_tagline && ( is_home() || is_front_page() ) ) {
$nona_title_text .= "$sep$site_tagline";
}
/** End if - site tagline */

/** End if - paged */
/** Add a page number if necessary */
if ( $paged >= 2 || $page >= 2 ) {
$nona_title_text .= $sep . sprintf( __( 'Page %s', 'nona' ), max( $paged, $page ) );
}

/** End if - paged */

return $nona_title_text;

} else {

return null;

return $nona_title_text;
} /** End if - sanity check for WordPress 4.1 */

}
/** End function - title */
Expand Down Expand Up @@ -520,4 +537,9 @@ function nona_show_featured_image( $size ) {
}
/** End if - has post thumbnail */

} /** End function - show featured image */
} /** End function - show featured image */

/** ------------------------------------------------------------------------- */

/** BNS Login Compatibility - Use Dashicons instead of text links */
add_filter( 'bns_login_dashed_set', '__return_true' );
15 changes: 10 additions & 5 deletions header.php
Expand Up @@ -12,22 +12,27 @@
* @author Edward Caissie <edward.caissie@gmail.com>
* @copyright Copyright (c) 2009-2014, Edward Caissie
*
* @version 1.6
* @date July 10, 2012
* Updated `wp_title` usage
*
* @version 1.8
* @date March 14, 2013
* Updated DOCTYPE and other related header elements
* Code formatting to be more easily read
* Move Comment Reply script enqueue to 'functions.php'
*
* @version 1.9.2
* @date December 27, 2014
* Added check for WordPress 4.1 `add_theme_support( 'title-tag' )` functionality
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php wp_title( '|', true, 'right' ); ?></title>

<?php /** Check for WordPress 4.1 compatibility */
if ( ! function_exists( '_wp_render_title_tag' ) ) { ?>
<title><?php wp_title( '|', true, 'right' ); ?></title>
<?php } ?>

<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
Expand Down

0 comments on commit 56492b2

Please sign in to comment.