Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added support to store bloginfo translations and display accordingly

  • Loading branch information...
commit 649d8b14aaa63b094bbf8eab9e5ae5b7760033dc 1 parent 3a647a6
@vdepizzol authored
Showing with 16 additions and 7 deletions.
  1. +1 −1  backend.php
  2. +15 −6 wppo.php
View
2  backend.php
@@ -495,7 +495,7 @@ function wppo_generate_po_xml($post_type) {
case 'content':
- $row->{$column} = wpautop($row->{$column});
+ $row->{$column} = wptexturize(wpautop($row->{$column}));
$node[$tag]['value'] = $dom->createDocumentFragment();
$node[$tag]['value']->appendXML('<html>'.$row->{$column}.'</html>');
View
21 wppo.php
@@ -290,7 +290,10 @@ function parse_bloginfo($bloginfo, $attribute) {
* and other generic page requests
*/
- add_filter('the_title', function($title, $id) {
+ add_filter('the_title', 'parse_title', 10, 2);
+ add_filter('single_post_title', 'parse_title', 10, 2);
+
+ function parse_title($title, $id) {
global $wppo_cache;
$translated_title = trim(wppo_get_translated_data('translated_title', $id));
@@ -300,9 +303,12 @@ function parse_bloginfo($bloginfo, $attribute) {
} else {
return $translated_title;
}
- }, 10, 2);
+ }
+
- add_filter('the_excerpt', function($excerpt) {
+ add_filter('the_excerpt', 'parse_excerpt', 10, 1);
+
+ function parse_excerpt($excerpt) {
global $wppo_cache, $post;
if (isset($wppo_cache['posts'][$post->ID])) {
@@ -316,9 +322,12 @@ function parse_bloginfo($bloginfo, $attribute) {
} else {
return $translated_excerpt;
}
- }, 10, 2);
+ }
+
- add_filter('the_content', function($content) {
+ add_filter('the_content', 'parse_content', 10, 1);
+
+ function parse_content($content) {
global $wppo_cache, $post;
if (isset($wppo_cache['posts'][$post->ID])) {
@@ -332,7 +341,7 @@ function parse_bloginfo($bloginfo, $attribute) {
} else {
return $translated_content;
}
- }, 10, 1);
+ }
add_filter('get_pages', function($pages) {
Please sign in to comment.
Something went wrong with that request. Please try again.