Skip to content

Instantly share code, notes, and snippets.

@iscat
Created May 19, 2013 02:21
Show Gist options
  • Save iscat/5606420 to your computer and use it in GitHub Desktop.
Save iscat/5606420 to your computer and use it in GitHub Desktop.
<?php
/* wp_title() expand
https://gist.github.com/mcatm/5113723
---------------------------------- */
function wp_title_expand($str = null) {
global $page, $paged;
$str .= (!$str) ? get_bloginfo('name') : ' - '.get_bloginfo('name');
$site_description = get_bloginfo('description', 'display');
if ($site_description && (is_home() || is_front_page())) $str .= ' - '.$site_description;
if ($paged >= 2 || $page >= 2) $str .= ' - ' . sprintf(__('Page %s'), max($paged, $page));
return $str;
}
add_filter('wp_title', 'wp_title_expand');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment