Cześć,

robię stronkę WP i korzystam z wtyczki polylang - tworzy wersje językowe, ale niestety nie tłumaczy wszystkiego...

1. button do rozwijania posta
2. footer w postach - to może później.

kod do pkt 1.
chodzi o zmianę wyrazu 'More' w końcówce kodu załączonego poniżej.

Jako, że dopiero zaczynam się uczyć php to nie wiem jak to ugryźć - w źródle strony, w zależności od języka tłumaczenia mam <html lang="en-GB">
lub <html lang="de-DE"> myślałem, że mógłbym dopisać jakoś if-a, który w zależności o tego 'lang' zmieniałby wyraz na 'Mehr' - da sie?

the_excerpt();
echo '<div style="clear:both"></div><a href="' . esc_url( get_permalink() ) . '" class="factorian-btn">'.esc_html__('More', 'factorian-crazycafe').'</a>';

  1. <?php
  2. /**
  3.  * Template part for displaying posts.
  4.  *
  5.  * @link <a href="https://codex.wordpress.org/Template_Hierarchy" target="_blank">https://codex.wordpress.org/Template_Hierarchy</a>
  6.  *
  7.  * @package factorian_Crazycafe
  8.  */
  9.  
  10. ?>
  11.  
  12. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  13. <header class="entry-header">
  14. <?php if(get_post_type() == 'work') :
  15. if(get_post_meta($post->ID, 'factorian_work_meta', true)) {
  16. $work_meta = get_post_meta($post->ID, 'factorian_work_meta', true);
  17. } else {
  18. $work_meta = array();
  19. }
  20.  
  21. $get_preview_images_array = $work_meta['gallery'];
  22. $get_preview_images = explode( ',', $get_preview_images_array );
  23. $preview_no = 0;
  24.  
  25. if(empty($get_preview_images)){
  26. $get_preview_images = array();
  27. }
  28. $total_preview = count($get_preview_images);
  29.  
  30. echo '<div class="row work-previews total-work-preview-'.$total_preview.'">';
  31. // Loop through them and output an image
  32. foreach ( $get_preview_images as $attachment_id ) {
  33. $preview_no++;
  34. if($total_preview == 1) {
  35. $preview_column = 'col-md-12';
  36. $preview_thumbnail_source = wp_get_attachment_image_src($attachment_id, 'full');
  37. } elseif($total_preview == 2) {
  38. $preview_column = 'col-md-6';
  39. } elseif($total_preview == 4) {
  40. $preview_column = 'col-md-3';
  41. $preview_thumbnail_source = wp_get_attachment_image_src($attachment_id, 'medium');
  42. } else {
  43. $preview_column = 'col-md-4';
  44. $preview_thumbnail_source = wp_get_attachment_image_src($attachment_id, 'large');
  45. };
  46.  
  47. $preview_link_source = wp_get_attachment_image_src($attachment_id, 'large');
  48. $preview_image_meta = wp_prepare_attachment_for_js($attachment_id);
  49. $preview_image_array = wp_get_attachment_image_src($attachment_id, 'large');
  50.  
  51. echo '
  52. <a title="'.esc_html($preview_image_meta['title']).'" title="" href="'.esc_url($preview_link_source[0]).'" class="'.esc_attr($preview_column).' single-work-preview-item image-popup-link">
  53. <div class="work-thumbnail-wrap">
  54. <span class="work-thumb-loading"><i class="fa fa-cog fa-spin"></i> '.esc_html__('thumbnail loading', 'factorian-crazycafe').'</span>
  55. <span class="work-zoom-icon"><i class="fa fa-search"></i></span>
  56. <div style="background-image:url('.esc_url($preview_image_array[0]).')" class="single-work-preview single-work-preview-'.esc_attr($preview_no).'"></div>
  57. </div>
  58. </a>
  59. ';
  60. }
  61. echo '</div>';
  62. ?>
  63.  
  64. <?php else : ?>
  65. <?php if(has_post_thumbnail()) : ?>
  66. <div class="factorian-post-featured-content">
  67. <?php the_post_thumbnail('factorian-crazycafe-thumb'); ?>
  68. </div>
  69. <?php endif; ?>
  70. <?php if (( 'post' === get_post_type() ) && !is_singular() ) : ?>
  71. <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
  72. <?php endif; ?>
  73. <?php endif; ?>
  74.  
  75. </header><!-- .entry-header -->
  76.  
  77. <div class="entry-content">
  78. <?php
  79. if(is_single()) {
  80. the_content( sprintf(
  81. /* translators: %s: Name of current post. */
  82. wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'factorian-crazycafe' ), array( 'span' => array( 'class' => array() ) ) ),
  83. the_title( '<span class="screen-reader-text">"', '"</span>', false )
  84. ) );
  85.  
  86. wp_link_pages( array(
  87. 'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'factorian-crazycafe' ),
  88. 'after' => '</div>',
  89. ) );
  90. } else {
  91. the_excerpt();
  92. echo '<div style="clear:both"></div><a href="' . esc_url( get_permalink() ) . '" class="factorian-btn">'.esc_html__('More', 'factorian-crazycafe').'</a>';
  93. }
  94.  
  95. ?>
  96. </div><!-- .entry-content -->
  97.  
  98. <footer class="entry-footer">
  99. <?php if('post' === get_post_type()) {factorian_crazycafe_posted_on();} factorian_crazycafe_entry_footer(); ?>
  100. </footer><!-- .entry-footer -->
  101. </article><!-- #post-## -->