- This topic has 5 replies, 2 voices, and was last updated 6 years, 4 months ago by
Tom.
-
AuthorPosts
-
November 28, 2019 at 9:31 am #1081788
Dave
I have a multilingual site using Polylang Pro. The site is up-to-date and runs the latest version of GP Premium (1.9.1?).
We use custom excerpts for posts, and I seem to remember we needed to include the following code to get ‘Read More’ to appear:
/* Filter - Remove default 'excerpt more' ---------------------------------------------------------------------------- */ function themeprefix_excerpt_more( $more ) { return ''; } add_filter('excerpt_more', 'themeprefix_excerpt_more', 21 ); /* Filter - Add 'read more' to custom excerpt ---------------------------------------------------------------------------- */ function themeprefix_get_the_excerpt( $excerpt ) { $output = $excerpt; $output = sprintf( '%1$s <p class="read-more-container"><a class="button read-more" href="%2$s" title="">%3$s</a></p>', $excerpt, get_permalink(), __( 'Read more', 'plugin' ) ); return $output; } add_filter( 'get_the_excerpt', 'themeprefix_get_the_excerpt' );We’re having trouble getting these strings to translate. I’ve checked that the ‘Read More’ text is blank in the customisr, and also tried adding this code, too.
I’ll include the link for admins, the Spanish can be accessed by visiting
/es/November 28, 2019 at 6:30 pm #1082200Tom
Lead DeveloperLead DeveloperHi there,
What if you replace this:
__( 'Read more', 'plugin' )With this?:
__( 'Read more', 'gp-premium' )If not, you might need to use this function in Polylang: https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/#pll__
pll__( 'Read more' )Let me know if you need more info 🙂
November 28, 2019 at 11:42 pm #1082374Dave
Thanks, Tom!
__( 'Read more', 'gp-premium' )produces the same result. How would the Polylang function interact with the previous code?November 29, 2019 at 9:54 am #1083453Tom
Lead DeveloperLead DeveloperTry this:
add_action( 'init', function() { pll_register_string( 'gp-premium-read-more', 'Read more' ); } );Then replace this:
__( 'Read more', 'gp-premium' )With this:
pll__( 'Read more' )Now it should show in your “String Translations” area in the Dashboard.
November 29, 2019 at 9:59 am #1083465Dave
That’s perfect – thanks so much, Tom!
November 29, 2019 at 7:45 pm #1085175Tom
Lead DeveloperLead DeveloperYou’re welcome! 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.