Viewing 3 reply threads
  • Author
    Posts
    • #4341
      cosmocanuck
      Member

      Hi 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.
    • #4344
      Steve
      Keymaster

      @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.

    • #4345
      cosmocanuck
      Member

      Fantastic – thanks. Works great!

      Going to hit the books a bit more on arrays. They still make my head hurt a bit. 8^)

    • #4347
      Steve
      Keymaster

      Great. Closing ticket.

Viewing 3 reply threads
  • The topic ‘Reactivated: Checking for value of a repeating field seems not to work’ is closed to new replies.