Split 'the_content' in three separate sections
-
Hi all,
When I think about it, I would basically want to see that ‘the_content’ will be split in three sections, f.i.:
– the first paragraph;
– the featured image with caption text;
– the rest of ‘the_content’.Can you help me out on this?
Because I have already tried this:
?php // original content display // the_content(); // split content into array $content = split_content(); // output first content section in intro echo '<div id=”intro">', array_shift($content), '</div>'; // output featured image after intro if( sdw_get_option( 'lay_a_fimg' ) && ( !$format || ($format && sdw_get_option('lay_a_format') == 'icon') ) && $fimg = sdw_featured_image('sdw-lay-a') ): echo $fimg; if(sdw_get_option( 'lay_a_fimg_cap' ) && !$format && $caption = get_post(get_post_thumbnail_id())->post_excerpt) : ?> <figcaption> <?php echo $caption; ?> </figcaption> endif; // output remaining content sections in column2 echo '<div id=”restofcontent">', implode($content), '</div>'; ?>
And that does not seem to work.
Hoping to hear from you soon.
Kindest regards,
Irene
https://www.mightymusings.nl
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Split 'the_content' in three separate sections’ is closed to new replies.