Skip to content

Instantly share code, notes, and snippets.

@kovshenin
Created June 25, 2012 15:44
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kovshenin/2989352 to your computer and use it in GitHub Desktop.
Save kovshenin/2989352 to your computer and use it in GitHub Desktop.
<?php
/*
* Plugin Name: Oh noes, not another SEO plugin!
* License: GPLv3 http://www.gnu.org/copyleft/gpl.html
*/
add_filter( 'wp_title', function( $title ) {
if ( is_singular() ) $title .= ' &mdash; ' . get_bloginfo( 'name' );
if ( is_archive() ) $title = sprintf( ' Archives: %s &mdash; %s', $title, get_bloginfo( 'name' ) );
if ( is_home() ) $title = sprintf( '%s &mdash; %s', get_bloginfo( 'name' ), get_bloginfo( 'description' ) );
if ( is_search() ) $title = sprintf( 'Searching for: %s &mdash; %s', get_search_query( true ), get_bloginfo( 'description' ) );
if ( is_paged() ) $title .= sprintf( ' &mdash; Page %d', get_query_var( 'paged' ) );
return $title;
});
@neverything
Copy link

Love it ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment