Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. // Lets try Advanced Custom Fields
  2. if ( have_rows('chapter') ) :
  3. while ( have_rows('chapter') ) : the_row();
  4. $chapter_title = get_sub_field('chapter_title');
  5. echo '<h1>' . $chapter_title . '</h1>';
  6. if ( have_rows('content') ) :
  7. while ( have_rows('content') ) : the_row();
  8. if ( get_row_layout() == 'text' ) :
  9. echo '<p>' . the_sub_field('text') . '</p>';
  10. elseif ( get_row_layout() == 'image' ) :
  11. $img = get_sub_field('image');
  12. echo '<img src="' . $img . '"/>';
  13. elseif ( get_row_layout() == 'quote' ) :
  14. echo '<p>' . the_sub_field('quote') . '</p>';
  15. endif;
  16. endwhile;
  17. else :
  18. echo '<h3>Please add content to ' . $chapter_title . '.</h3>';
  19. endif;
  20. endwhile;
  21. else :
  22. echo '<h2>Please add content to this post.</h2>';
  23. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement