Guest User

Pinboard WordPress Theme Title Proposed Revision

a guest
Mar 14th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.78 KB | None | 0 0
  1. // Kyle Krafka (March 15, 2013)
  2.  
  3. function pinboard_doc_title( $doc_title ) {
  4.     global $page, $paged;
  5.     $doc_title = str_replace( '» ', '', $doc_title ); // Notice the added space after »
  6.     $site_description = get_bloginfo( 'description', 'display' );
  7.     $separator = '|'; // | ... I brought the & and ; into the $separator string
  8.  
  9.     if ( is_front_page() ) {
  10.         // Display the title of the website, regardless of the page title
  11.         $doc_title = get_bloginfo( 'name' );
  12.         if ( $site_description )
  13.             // And the site description if there is one, though this may look like the rest of the pages, only flipped around the |
  14.             $doc_title .= ' ' . $separator . ' ' . $site_description;
  15.     } else {
  16.         // For every other page, use "Page | Site Name" (and page number, if appropriate)
  17.         if ( $paged >= 2 || $page >= 2 )
  18.             $doc_title .= ', ' . __( 'Page', 'pinboard' ) . ' ' . max( $paged, $page );
  19.         $doc_title .= ' ' . $separator . ' ' . get_bloginfo('name');
  20.     }
  21.     return $doc_title;
  22. }
  23.  
  24. // Compare to the original:
  25.  
  26. function pinboard_doc_title( $doc_title ) {
  27.     global $page, $paged;
  28.     $doc_title = str_replace( '»', '', $doc_title );
  29.     $site_description = get_bloginfo( 'description', 'display' );
  30.     $separator = '#124';
  31.     if ( is_singular() ) {
  32.         if( is_front_page() )
  33.             $doc_title .=  get_the_title();
  34.         if ( $paged >= 2 || $page >= 2 )
  35.             $doc_title .=  ', ' . __( 'Page', 'pinboard' ) . ' ' . max( $paged, $page );
  36.     } else {
  37.         if( ! is_home() )
  38.             $doc_title .= ' &' . $separator . '; ';
  39.         $doc_title .= get_bloginfo( 'name' );
  40.         if ( $paged >= 2 || $page >= 2 )
  41.             $doc_title .=  ', ' . __( 'Page', 'pinboard' ) . ' ' . max( $paged, $page );
  42.     }
  43.     if ( ( is_home() ) && $site_description )
  44.         $doc_title .= ' &' . $separator . '; ' . $site_description;
  45.     return $doc_title;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment