Wordpress Simple Fields Plugin - Show Repeatable Region


/ Published in: PHP
Save to your folder(s)

Dispaly a repeatable region using the Simple Fields wordpress plugin.


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. $childPagesRepeatedGroup = simple_fields_get_post_group_values(get_the_id(),"Child Pages", true, 2);
  4.  
  5. if ( isset($childPagesRepeatedGroup) && count($childPagesRepeatedGroup) > 0 ) {
  6.  
  7. foreach ( $childPagesRepeatedGroup as $childPage ) {
  8.  
  9. $imageSource = wp_get_attachment_image_src($childPage['Pic']);
  10. ?>
  11.  
  12. <div class="child-links">
  13. <img src="<?php print $imageSource[0]; ?>" width="<?php print $imageSource[1]; ?>" height="<?php print $imageSource[2]; ?>" />
  14. <h2><?php print $childPage['Heading']; ?></h2>
  15. <p><?php print $childPage['Text']; ?></p>
  16. </div>
  17.  
  18. <?php
  19.  
  20. }
  21. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.