Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Lets try Advanced Custom Fields
- if ( have_rows('chapter') ) :
- while ( have_rows('chapter') ) : the_row();
- $chapter_title = get_sub_field('chapter_title');
- echo '<h1>' . $chapter_title . '</h1>';
- if ( have_rows('content') ) :
- while ( have_rows('content') ) : the_row();
- if ( get_row_layout() == 'text' ) :
- echo '<p>' . the_sub_field('text') . '</p>';
- elseif ( get_row_layout() == 'image' ) :
- $img = get_sub_field('image');
- echo '<img src="' . $img . '"/>';
- elseif ( get_row_layout() == 'quote' ) :
- echo '<p>' . the_sub_field('quote') . '</p>';
- endif;
- endwhile;
- else :
- echo '<h3>Please add content to ' . $chapter_title . '.</h3>';
- endif;
- endwhile;
- else :
- echo '<h2>Please add content to this post.</h2>';
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement