Want more features on Pastebin? Sign Up, it's FREE!
Guest

WP SEO plugin patch

By: a guest on Jun 19th, 2012  |  syntax: Diff  |  size: 3.30 KB  |  views: 87  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. From 69e5028efaa907678ca4fc37fa9929383530907f Mon Sep 17 00:00:00 2001
  2. From: Fabien Quatravaux <fabien.quatravaux@1nterval.com>
  3. Date: Tue, 19 Jun 2012 13:16:08 +0200
  4. Subject: [PATCH] Add the possibility to force static home page title
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8.  
  9. ---
  10. admin/class-config.php      |    9 +++++++--
  11.  frontend/class-frontend.php |    6 +++---
  12.  2 files changed, 10 insertions(+), 5 deletions(-)
  13.  
  14. diff --git a/admin/class-config.php b/admin/class-config.php
  15. index 45316af..8d9654e 100644
  16. --- a/admin/class-config.php
  17. +++ b/admin/class-config.php
  18. @@ -508,7 +508,12 @@ if ( ! class_exists( 'WPSEO_Admin' ) ) {
  19.                                 </div>
  20.                                 <div id="home" class="wpseotab">
  21.                         <?php
  22. -                       if ( 'page' != get_option('show_on_front') ) {
  23. +                       if ( 'page' == get_option('show_on_front') ) {
  24. +                               echo '<h2>'.__('Title settings','wordpress-seo').'</h2>';
  25. +                               echo $this->checkbox('force-home-title',__('Force home page title','wordpress-seo'));
  26. +                       }
  27. +                      
  28. +                       if ( 'page' != get_option('show_on_front') || (isset($options['force-home-title']) && $options['force-home-title'])) {
  29.                                 echo '<h2>'.__('Homepage', 'wordpress-seo' ).'</h2>';
  30.                                 echo $this->textinput('title-home',__('Title template', 'wordpress-seo' ));
  31.                                 echo $this->textarea('metadesc-home',__('Meta description template', 'wordpress-seo' ), '', 'metadesc');
  32. @@ -521,7 +526,7 @@ if ( ! class_exists( 'WPSEO_Admin' ) ) {
  33.                                 echo '<p>' . sprintf( __('You can determine the title and description for the blog page by %sediting the blog page itself &raquo;%s', 'wordpress-seo' ), '<a href="'.get_edit_post_link( get_option('page_for_posts') ).'">', '</a>' ) . '</p>';
  34.                         }
  35.                        
  36. -                       if ( 'page' != get_option('show_on_front') ) {
  37. +                       if ( 'page' != get_option('show_on_front') || (isset($options['force-home-title']) && $options['force-home-title'])) {
  38.                                 echo '<h2>'.__('Author metadata', 'wordpress-seo' ).'</h2>';
  39.                                 echo '<label class="select" for="">'.__('Author highlighting','wordpress-seo').':</label>';
  40.                                 wp_dropdown_users( array( 'show_option_none' => "Don't show", 'name' => 'wpseo_titles[plus-author]', 'class' => 'select','selected' => isset($options['plus-author']) ? $options['plus-author'] : '' ) );
  41. diff --git a/frontend/class-frontend.php b/frontend/class-frontend.php
  42. index 0009845..fbb0ef1 100644
  43. --- a/frontend/class-frontend.php
  44. +++ b/frontend/class-frontend.php
  45. @@ -173,7 +173,7 @@ class WPSEO_Frontend {
  46.        
  47.         function title( $title, $sepinput = '-', $seplocation = '', $postid = '' ) {
  48.                 global $sep;
  49. -              
  50. +               $options = get_option('wpseo_titles');
  51.                 $sep = $sepinput;
  52.                
  53.                 if ( is_feed() )
  54. @@ -206,10 +206,10 @@ class WPSEO_Frontend {
  55.                 // that is used to generate default titles.
  56.                 $title_part = '';              
  57.                        
  58. -               if ( $this->is_home_static_page() ) {
  59. +               if ( $this->is_home_static_page() && !(isset($options['force-home-title']) && $options['force-home-title'])) {
  60.                         global $post;
  61.                         $title = $this->get_content_title();
  62. -               } else if ( $this->is_home_posts_page() ) {
  63. +               } else if ( $this->is_home_posts_page() || $this->is_home_static_page() ) {
  64.                         $title = $this->get_title_from_options( 'title-home' );
  65.                 } else if ( $this->is_posts_page() ) {
  66.                         $title = $this->get_content_title( get_post( get_option( 'page_for_posts' ) ) );
  67. --
  68. 1.7.5.4
clone this paste RAW Paste Data