php - wordpress WPML advanced fields relationship -
i'm making multilanguage website uses advanced custom fields relationship plugin. i'm reading out employers , if read em out in site's native language have 0 problems, when try read them out in language empty array. of guys know can do?
<?php $field = get_post_meta( get_the_id() ); $posts = get_field('field_81'); echo '<!--'; echo 'test '; var_dump( $field ); var_dump( $posts ); echo '-->'; ?> <?php if (icl_language_code == 'en'): ?> <?php $fields = $field['medewerkers']; ?> <?php $posts = $fields; ?> <?php endif; ?> <?php if ($posts): ?> <?php if (icl_language_code == 'nl'): ?> <h3 class="titelmedewerkers">medewerkers</h3> <?php elseif (icl_language_code == 'en'): ?> <h3 class="titelmedewerkers">employees</h3> <?php elseif (icl_language_code == 'fr'): ?> <h3 class="titelmedewerkers">employes</h3> <?php else: ?> <h3 class="titelmedewerkers">medewerkers</h3> <?php endif; ?> <ul class="medewerkers"> <?php foreach ($posts $post): // variable must called $post (important) ?> <?php setup_postdata($post); ?> <li class="shadow"> <strong><?php the_title(); ?></strong><br /> <?php if (get_field('foto')): ?> <?php $attachment_id = get_field('foto'); $size = "medium"; $image = wp_get_attachment_image_src($attachment_id, $size); ?> <img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>" /><br /> <?php endif; ?> <?php if (get_field('afdeling')): ?> <?php the_field('afdeling'); ?><br /> <?php endif; ?> <?php if (get_field('titel')): ?> <?php the_field('titel'); ?><br /> <?php endif; ?> <?php if (get_field('tel')): ?> <a href="tel:<?php the_field('tel'); ?>"><?php the_field('tel'); ?></a><br /> <?php endif; ?> </li> <?php endforeach; ?> <?php wp_reset_postdata(); ?> </ul> <?php endif; ?> <?php wp_reset_postdata(); ?>
this part:
<?php if (icl_language_code == 'en'): ?> <?php $fields = $field['medewerkers']; ?> <?php $posts = $fields; ?> <?php endif; ?>
creates $post when en
, not surprising don't have in other languages
Comments
Post a Comment