- This topic has 3 replies, 2 voices, and was last updated 6 years, 4 months ago by
Steve.
-
AuthorPosts
-
-
September 15, 2015 at 2:51 pm #4341
cosmocanuckMemberHi Steve! Sorry, guess I should have kept that last ticket open. I followed your advice and the code makes sense, but some baffling things are still happening.
If I change the last parameter to “false” as I’m supposed to for an array, my template code returns only the word “Array”, not the field value I want. If I switch it back to “true”, it displays correctly.
Here again is my current code to call the repeating-field template:
<?php $ticket_links = get_post_meta($post->ID, 'ticket_links', true); piklist('buy-tickets-template', array('data' => $ticket_links, 'loop' => 'data')); ?>And here’s what’s in buy-tickets-template.php:
<?php echo '<a class="ticketButton" href="' . $data['screeningURL'] . '" target="_self">' . 'Buy tickets for ' . $data['screeningdate'] . '</a>';I’ve attached the button which I’m generating with the above template code. With that get_post_meta param set to false, the button reads “Buy Tickets for Array”.
I’ve sifted through the instructions for displaying repeating fields but simply can’t figure out what I’m doing wrong – I’m trying to follow it to the letter….
Adam
Attachments:
You must be logged in to view attached files. -
September 15, 2015 at 4:02 pm #4344
SteveKeymaster@cosmocanuck– Your new data is in an array with the key of [0], so you need to tell this to Piklist:
piklist('buy-tickets-template', array('data' => $ticket_links[0], 'loop' => 'data'));Let me know if that works for you.
-
September 15, 2015 at 4:51 pm #4345
cosmocanuckMemberFantastic – thanks. Works great!
Going to hit the books a bit more on arrays. They still make my head hurt a bit. 8^)
-
September 16, 2015 at 11:11 am #4347
SteveKeymasterGreat. Closing ticket.
-
-
AuthorPosts
- The topic ‘Reactivated: Checking for value of a repeating field seems not to work’ is closed to new replies.