Divi Post Data

This Divi module allows you add additional post data to your post layouts, including:

Z

Estimated reading time

Z

Post word count

Z

Post update date

Z

Time since last updated

Z

Time since published

Z

Translation Ready (learn more)

Additional Features

L

Includes Icon Selection

Make your new post data ‘pop’ by adding a visual element, such as an icon, to make it really stand out and enhance your design.

CSS Control

The plugin provides access to advanced CSS fields so you have unlimited control to style the data to match your design.

Theme Builder-ready

This plugin was built specifically with the Divi Theme builder in mind so it’s ready to integrate seamlessly into your Divi-enabled website.

Translating the Text

To translate the text in the plugin, you just need to take advantage of the WordPress built in ‘gettext‘ filter.

Place the following block of code in your child theme’s functions.php file.

add_filter( 'gettext', 'translate_post_data_strings_wpcc', 999, 3 );

function translate_post_data_strings_wpcc( $translated, $untranslated, $domain )
{
  if ( ! is_admin() && 'dpdw-divi-post-data-wpcc' === $domain ) :

    switch ( $translated ) :
   
      case 'year' :
        $translated = 'REPLACE_WITH_TRANSLATION';
      break;

      case 'years' :
        $translated = 'REPLACE_WITH_TRANSLATION';
      break;

      case 'month' :
        $translated = 'REPLACE_WITH_TRANSLATION';
      break;

      case 'months' :
        $translated = 'REPLACE_WITH_TRANSLATION';
      break;

      case 'day' :
        $translated = 'REPLACE_WITH_TRANSLATION';
      break;

      case 'days' :
        $translated = 'REPLACE_WITH_TRANSLATION';
      break;

    endswitch;

  endif;

  return $translated;
}

How to use this code

Change the placeholder REPLACE_WITH_TRANSLATION with your desired string.

For example, consider the following snippet of code: 

case 'year' :
  $translated = 'REPLACE_WITH_TRANSLATION';
break;

If you were to replace the string REPLACE_WITH_TRANSLATION with the string ‘año‘ (the Spanish word for ‘year’) the plugin would replace the English word ‘year‘ with ‘año‘  when it prints to the screen.

Your code would then look like the following:

case 'year' :
  $translated = 'año';
break;