Translating a select list in ACF
-
I am greeting a dropdown menu (select list) on the front end containing values from a series of ACF entries, including repeater fields, in the back end. Also, then entire output must be translatable view WPML and sorted according to one of the entries in the repeater, namely ‘book’.
Everything works EXCEPT that the ‘book’ is not translated on the front end. In the back end I see the alternate language (Indonesian) in the select list, but the output remains English. I have tried various permutations and placements for the translate code. Below is the version that I started with and that seems logically correct, though I must be over-looking something.
<br /> <!--START OF SELECT LIST --><br /> <select id="selectLookup" onchange="location = this.options[this.selectedIndex].value;"><br /> <option value="#"><?php _e( 'Specific Passage Lookup', 'biblereference' ) ?></option><br /> <?php<br /> $allBooks = array('Genesis', 'Exodus', 'Leviticus', 'Numbers', 'Deuteronomy', 'Joshua', 'Judges', 'Ruth', '1 Samuel', '2 Samuel', '1 Kings', '2 Kings', '1 Chronicles', '2 Chronicles', 'Ezra', 'Nehemiah', 'Esther', 'Job', 'Psalms', 'Proverbs', 'Ecclesiastes', 'Song of Solomon', 'Isaiah', 'Jeremiah', 'Lamentations', 'Ezekiel', 'Daniel', 'Hosea', 'Joel', 'Amos', 'Obadiah', 'Jonah', 'Micah', 'Nahum', 'Habakkuk', 'Zephaniah', 'Haggai', 'Zechariah', 'Malachi', 'Matthew', 'Mark', 'Luke', 'John', 'Acts', 'Romans', '1 Corinthians', '2 Corinthians', 'Galatians', 'Ephesians', 'Philippians', 'Colossians', '1 Thessalonians', '2 Thessalonians', '1 Timothy', '2 Timothy', 'Titus', 'Philemon', 'Hebrews', 'James', '1 Peter', '2 Peter', '1 John', '2 John', '3 John', 'Jude', 'Revelation');<br /> foreach ($allBooks as &$currentBook) {</p> <p> $refNtitle=array(<br /> 'post_type' => 'post',<br /> 'post_status' => 'publish'<br /> );<br /> $my_query = null;<br /> $my_query = new WP_Query($refNtitle);<br /> if( $my_query->have_posts() ) {<br /> while ($my_query->have_posts()) : $my_query->the_post();<br /> if( have_rows('bible_reference') ){<br /> while ( have_rows('bible_reference') ) : the_row();<br /> if(get_sub_field('book') == $currentBook){ ?><br /> <option value="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><br /> <?php $bookName = get_sub_field('book') ?><br /> <?php _e( $bookName, 'biblereference' ); ?><br /> <?php the_sub_field("verse"); }?> -<br /> <?php _e( the_field('short_title'), 'biblereference' ); ?> </option> </p> <p> <?php<br /> endwhile; //end while have_rows<br /> }<br /> endwhile; //end while hav_posts<br /> }<br /> wp_reset_query();<br /> }<br /> unset($value); // break the reference with the last element<br /> ?><br /> </select></p> <p><!--END OF SELECT LIST --><br />
Assistance is appreciated. Thanks.
https://www.ads-software.com/plugins/advanced-custom-fields/
- The topic ‘Translating a select list in ACF’ is closed to new replies.