split "the_content"

Is it possible to split the <?php the_content(); ?>
What i mean is having the text, photos and etc in separated div?

Who is Participating?

Improve company productivity with a Business Account.Sign Up

gwkgConnect With a Mentor Commented:
You can do anything you want to the_content() with a custom function and filter.


Exactly how to create a function that separates the images from the text is a question better asked in the PHP zone.
Ryan WeaverInfrastructure ManagerCommented:
Out of the box, I don't think so:
Function Reference/the content
Customizing the Read More
h4hardySr. Software EnginnerCommented:
no you are not able to do the same.
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

maybe usng some regExp.. but it would be some work.
using Featured images (+ MultiPostThumbnails) you can separate text and images better
RefaelAuthor Commented:

Hi ovi_mihai, thanks,

I do use the 'Featured images' that's why i want to control the text div and the image div.
ovi_mihaiConnect With a Mentor Commented:
regexp is not pretty

try patern like /<img([^>]*)>/

in a preg_match_all function.

then you'll need to remove the images with preg_replace and the same patern.

it should work fine but it is not the sure way
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.