Home › Forums › Pro Support › WPML and "Read more…" translation problems
- This topic has 34 replies, 4 voices, and was last updated 2 years, 4 months ago by
Tom.
-
AuthorPosts
-
October 28, 2020 at 2:38 pm #21832
Samuel
ParticipantHi Tom,
This is working for styling issue perfectly, thanks !
But this function is still breaking the job we’ve done together regarding the “redirecting to custom url” thing (reply #20708)
October 29, 2020 at 1:59 pm #21898Tom
KeymasterAh, so use the code we came up with there, but replace this:
$settings['read_more_text']
With this:
__( 'Read more', 'wp-show-posts' )
October 30, 2020 at 3:36 am #21946Samuel
ParticipantHi Tom,
Thanks again for your time, your support is amazing, but it’s not working. Here is the entire hook we are using combining custom redirection + read more translation :
<?php add_filter( 'wpsp_title_href', function( $href ) { $custom_url = get_post_meta( get_the_ID(), 'url-booking', true ); if ( $custom_url ) { return $custom_url; } return $href; } ); add_filter( 'wpsp_image_href', function( $href ) { $custom_url = get_post_meta( get_the_ID(), 'url-booking', true ); if ( $custom_url ) { return $custom_url; } return $href; } ); add_filter( 'wpsp_read_more_output', function( $output, $settings ) { $custom_url = get_post_meta( get_the_ID(), 'url-booking', true ); if ( $custom_url ) { return sprintf( '<div class="wpsp-read-more"><a title="%1$s" class="%4$s" href="%2$s">%3$s</a></div>', the_title_attribute( 'echo=0' ), esc_url( $custom_url ), __( 'Read more', 'wp-show-posts' ), esc_attr( $settings['read_more_class'] ) ); } return $output; }, 10, 2 ); add_filter( 'wpsp_terms_output', function( $output ) { return strip_tags( $output ); } ); add_filter( 'wpsp_read_more_output', function( $output, $settings ) { return sprintf( '<div class="wpsp-read-more"><a title="%1$s" class="%4$s" href="%2$s">%3$s</a></div>', the_title_attribute( 'echo=0' ), esc_url( get_permalink() ), __( 'Voir les tarifs', 'wp-show-posts' ), esc_attr( $settings['read_more_class'] ) ); }, 10, 2 ); ?>
October 30, 2020 at 3:44 am #21950Samuel
ParticipantOh sorry, my bad, with the confusion of the our 2 different issues (redirection and translation) there was 2 functions conflicting, now it’s working, and here is the final word :
<?php add_filter( 'wpsp_title_href', function( $href ) { $custom_url = get_post_meta( get_the_ID(), 'url-booking', true ); if ( $custom_url ) { return $custom_url; } return $href; } ); add_filter( 'wpsp_image_href', function( $href ) { $custom_url = get_post_meta( get_the_ID(), 'url-booking', true ); if ( $custom_url ) { return $custom_url; } return $href; } ); add_filter( 'wpsp_read_more_output', function( $output, $settings ) { $custom_url = get_post_meta( get_the_ID(), 'url-booking', true ); if ( $custom_url ) { return sprintf( '<div class="wpsp-read-more"><a title="%1$s" class="%4$s" href="%2$s">%3$s</a></div>', the_title_attribute( 'echo=0' ), esc_url( $custom_url ), __( 'Voir les tarifs', 'wp-show-posts' ), esc_attr( $settings['read_more_class'] ) ); } return $output; }, 10, 2 ); add_filter( 'wpsp_terms_output', function( $output ) { return strip_tags( $output ); } );
?>`
October 30, 2020 at 11:40 am #22000Tom
KeymasterGlad it’s working now 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.