-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
206 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
|
||
/** | ||
* @package WP Subtitle | ||
* @subpackage SEOPress | ||
* | ||
* @since 3.4 | ||
* | ||
* Compatibility for the SEOPress plugin: | ||
* https://wordpress.org/plugins/wp-seopress/ | ||
* | ||
* Adds support for a `%%wps_subtitle%%` placeholder to include | ||
* the subtitle in browser titles and meta descriptions. | ||
* | ||
* Also adds `%%wps_subtitle_before_sep%%` and `%%wps_subtitle_after_sep%%`. | ||
* These can be used to add seperators before/after the subtitle. If there | ||
* is no subtitle set these placeholders will not be output. | ||
* | ||
* The seperator placeholders can be customized using the `wps_subtitle_seo_before_sep` | ||
* and `wps_subtitle_seo_after_sep` filters. | ||
* | ||
* The seperator placeholders include a 'space' either side by default. This means that | ||
* you should create your title template with no whitespace around the seperator placeholders. | ||
* It allows you to customize the seperators to include commas and butt the seperator up to | ||
* the preceding/following text. | ||
* | ||
* e.g. If '%%wps_subtitle_before_sep%%' is set to ', ': | ||
* `%%title%%%%wps_subtitle_before_sep%%%%wps_subtitle%% %%sep%% %%sitename%%` | ||
* "Title, Subtitle - Sitename" | ||
*/ | ||
|
||
class WPSubtitle_SEOPress { | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @since 3.4 | ||
* | ||
* @internal Do not create multiple instances. | ||
*/ | ||
public function __construct() { | ||
|
||
add_filter( 'seopress_titles_template_variables_array', array( $this, 'add_seopress_replacements' ) ); | ||
add_filter( 'seopress_titles_template_replace_array', array( $this, 'replace_seopress_replacements' ) ); | ||
|
||
} | ||
|
||
/** | ||
* Add SEOPress Replacements Variables | ||
* | ||
* @since 3.4 | ||
* | ||
* @param array $replacements SEO replacements variables. | ||
* @return array Filtered replacements variables. | ||
* | ||
* @internal Called via the `seopress_titles_template_variables_array` filter. | ||
*/ | ||
public function add_seopress_replacements( $replacements ) { | ||
|
||
$replacements[] = '%%wps_subtitle%%'; | ||
$replacements[] = '%%wps_subtitle_before_sep%%'; | ||
$replacements[] = '%%wps_subtitle_after_sep%%'; | ||
|
||
return $replacements; | ||
|
||
} | ||
|
||
/** | ||
* Replace SEOPress Replacements Values | ||
* | ||
* @since 3.4 | ||
* | ||
* @param array $replacements SEO replacements values. | ||
* @return array Filtered replacements values. | ||
* | ||
* @internal Called via the `seopress_titles_template_replace_array` filter. | ||
*/ | ||
public function replace_seopress_replacements( $replacements ) { | ||
|
||
global $post; | ||
|
||
$wp_subtitle = new WP_Subtitle( $post ); | ||
$subtitle = $wp_subtitle->get_subtitle(); | ||
|
||
$replacements[] = $subtitle; | ||
|
||
$sep = ' ' . $replacements[0] . ' '; | ||
|
||
$before_sep = ''; | ||
$after_sep = ''; | ||
|
||
if ( ! empty( $subtitle ) ) { | ||
|
||
$before_sep = apply_filters( 'wps_subtitle_seo_before_sep', $sep ); | ||
$after_sep = apply_filters( 'wps_subtitle_seo_after_sep', $sep ); | ||
|
||
} | ||
|
||
$replacements[] = $before_sep; | ||
$replacements[] = $after_sep; | ||
|
||
return $replacements; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,63 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: WP Subtitle\n" | ||
"POT-Creation-Date: 2015-07-02 06:57-0000\n" | ||
"POT-Creation-Date: 2020-01-31 09:28+0000\n" | ||
"PO-Revision-Date: \n" | ||
"Last-Translator: me <[email protected]>\n" | ||
"Language-Team: \n" | ||
"Language: de_DE\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 1.7.3\n" | ||
"X-Generator: Poedit 2.2.4\n" | ||
"X-Poedit-SourceCharset: UTF-8\n" | ||
"X-Poedit-KeywordsList: __;_e;_x;_ex\n" | ||
"X-Poedit-Basepath: .\n" | ||
"Language: de_DE\n" | ||
"X-Poedit-SearchPath-0: ..\n" | ||
|
||
#: ../admin/admin.php:79 ../admin/admin.php:150 | ||
#: plugin/admin/admin.php:109 plugin/admin/admin.php:203 | ||
#: plugin/admin/admin.php:274 | ||
msgid "Subtitle" | ||
msgstr "Untertitel" | ||
|
||
#: ../admin/admin.php:200 | ||
#: plugin/admin/admin.php:317 plugin/admin/admin.php:344 | ||
msgid "Enter subtitle here" | ||
msgstr "Untertitel hier eingeben" | ||
|
||
#: ../admin/pointers.php:146 | ||
#: plugin/admin/pointers.php:149 | ||
#, php-format | ||
msgid "%s Field" | ||
msgstr "%sfeld" | ||
|
||
#: ../admin/pointers.php:147 | ||
#: plugin/admin/pointers.php:150 | ||
msgid "This field has moved from a meta box to below the post title." | ||
msgstr "Dieses Feld wurde aus einer Metabox unter den Beitragstitel verschoben." | ||
|
||
#: plugin/includes/compat/woocommerce.php:102 | ||
#, fuzzy | ||
#| msgid "Subtitle" | ||
msgid "WP Subtitle" | ||
msgstr "Untertitel" | ||
|
||
#: plugin/includes/compat/woocommerce.php:109 | ||
msgid "Enable Product Subtitles" | ||
msgstr "" | ||
|
||
#: plugin/includes/compat/woocommerce.php:110 | ||
msgid "Add subtitle field to product edit screen" | ||
msgstr "" | ||
|
||
#: plugin/includes/compat/woocommerce.php:117 | ||
#, fuzzy | ||
#| msgid "Subtitle" | ||
msgid "Subtitle Display" | ||
msgstr "Untertitel" | ||
|
||
#: plugin/includes/compat/woocommerce.php:118 | ||
msgid "Show on single product pages" | ||
msgstr "" | ||
|
||
#: plugin/includes/compat/woocommerce.php:126 | ||
msgid "Show on product archives" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: WP Subtitle\n" | ||
"POT-Creation-Date: 2018-12-19 23:04+0000\n" | ||
"POT-Creation-Date: 2020-01-31 09:28+0000\n" | ||
"PO-Revision-Date: \n" | ||
"Last-Translator: Ben Huson <[email protected]>\n" | ||
"Language-Team: \n" | ||
|
@@ -11,19 +11,18 @@ msgstr "" | |
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 2.2\n" | ||
"X-Generator: Poedit 2.2.4\n" | ||
"X-Poedit-SourceCharset: UTF-8\n" | ||
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c\n" | ||
"X-Poedit-Basepath: ../..\n" | ||
"X-Poedit-SearchPath-0: .\n" | ||
|
||
#: plugin/admin/admin.php:99 plugin/admin/admin.php:130 | ||
#: plugin/admin/admin.php:138 plugin/admin/admin.php:191 | ||
#: plugin/admin/admin.php:262 | ||
#: plugin/admin/admin.php:109 plugin/admin/admin.php:203 | ||
#: plugin/admin/admin.php:274 | ||
msgid "Subtitle" | ||
msgstr "" | ||
|
||
#: plugin/admin/admin.php:305 plugin/admin/admin.php:332 | ||
#: plugin/admin/admin.php:317 plugin/admin/admin.php:344 | ||
msgid "Enter subtitle here" | ||
msgstr "" | ||
|
||
|
@@ -36,26 +35,26 @@ msgstr "" | |
msgid "This field has moved from a meta box to below the post title." | ||
msgstr "" | ||
|
||
#: plugin/includes/compat/woocommerce.php:96 | ||
#: plugin/includes/compat/woocommerce.php:102 | ||
msgid "WP Subtitle" | ||
msgstr "" | ||
|
||
#: plugin/includes/compat/woocommerce.php:103 | ||
#: plugin/includes/compat/woocommerce.php:109 | ||
msgid "Enable Product Subtitles" | ||
msgstr "" | ||
|
||
#: plugin/includes/compat/woocommerce.php:104 | ||
#: plugin/includes/compat/woocommerce.php:110 | ||
msgid "Add subtitle field to product edit screen" | ||
msgstr "" | ||
|
||
#: plugin/includes/compat/woocommerce.php:111 | ||
#: plugin/includes/compat/woocommerce.php:117 | ||
msgid "Subtitle Display" | ||
msgstr "" | ||
|
||
#: plugin/includes/compat/woocommerce.php:112 | ||
#: plugin/includes/compat/woocommerce.php:118 | ||
msgid "Show on single product pages" | ||
msgstr "" | ||
|
||
#: plugin/includes/compat/woocommerce.php:120 | ||
#: plugin/includes/compat/woocommerce.php:126 | ||
msgid "Show on product archives" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.