From 69e5028efaa907678ca4fc37fa9929383530907f Mon Sep 17 00:00:00 2001
From: Fabien Quatravaux <fabien.quatravaux@1nterval.com>
Date: Tue, 19 Jun 2012 13:16:08 +0200
Subject: [PATCH] Add the possibility to force static home page title
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
admin/class-config.php | 9 +++++++--
frontend/class-frontend.php | 6 +++---
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/admin/class-config.php b/admin/class-config.php
index 45316af..8d9654e 100644
--- a/admin/class-config.php
+++ b/admin/class-config.php
@@ -508,7 +508,12 @@ if ( ! class_exists( 'WPSEO_Admin' ) ) {
</div>
<div id="home" class="wpseotab">
<?php
- if ( 'page' != get_option('show_on_front') ) {
+ if ( 'page' == get_option('show_on_front') ) {
+ echo '<h2>'.__('Title settings','wordpress-seo').'</h2>';
+ echo $this->checkbox('force-home-title',__('Force home page title','wordpress-seo'));
+ }
+
+ if ( 'page' != get_option('show_on_front') || (isset($options['force-home-title']) && $options['force-home-title'])) {
echo '<h2>'.__('Homepage', 'wordpress-seo' ).'</h2>';
echo $this->textinput('title-home',__('Title template', 'wordpress-seo' ));
echo $this->textarea('metadesc-home',__('Meta description template', 'wordpress-seo' ), '', 'metadesc');
@@ -521,7 +526,7 @@ if ( ! class_exists( 'WPSEO_Admin' ) ) {
echo '<p>' . sprintf( __('You can determine the title and description for the blog page by %sediting the blog page itself »%s', 'wordpress-seo' ), '<a href="'.get_edit_post_link( get_option('page_for_posts') ).'">', '</a>' ) . '</p>';
}
- if ( 'page' != get_option('show_on_front') ) {
+ if ( 'page' != get_option('show_on_front') || (isset($options['force-home-title']) && $options['force-home-title'])) {
echo '<h2>'.__('Author metadata', 'wordpress-seo' ).'</h2>';
echo '<label class="select" for="">'.__('Author highlighting','wordpress-seo').':</label>';
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'] : '' ) );
diff --git a/frontend/class-frontend.php b/frontend/class-frontend.php
index 0009845..fbb0ef1 100644
--- a/frontend/class-frontend.php
+++ b/frontend/class-frontend.php
@@ -173,7 +173,7 @@ class WPSEO_Frontend {
function title( $title, $sepinput = '-', $seplocation = '', $postid = '' ) {
global $sep;
-
+ $options = get_option('wpseo_titles');
$sep = $sepinput;
if ( is_feed() )
@@ -206,10 +206,10 @@ class WPSEO_Frontend {
// that is used to generate default titles.
$title_part = '';
- if ( $this->is_home_static_page() ) {
+ if ( $this->is_home_static_page() && !(isset($options['force-home-title']) && $options['force-home-title'])) {
global $post;
$title = $this->get_content_title();
- } else if ( $this->is_home_posts_page() ) {
+ } else if ( $this->is_home_posts_page() || $this->is_home_static_page() ) {
$title = $this->get_title_from_options( 'title-home' );
} else if ( $this->is_posts_page() ) {
$title = $this->get_content_title( get_post( get_option( 'page_for_posts' ) ) );
--
1.7.5.4