Skip to content

Instantly share code, notes, and snippets.

@kovshenin
Created June 25, 2012 15:44

Revisions

  1. kovshenin revised this gist Jun 25, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions plugin.php
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    <?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' );
  2. kovshenin created this gist Jun 25, 2012.
    12 changes: 12 additions & 0 deletions plugin.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <?php
    /*
    * Plugin Name: Oh noes, not another SEO plugin!
    */
    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;
    });