WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whenever I've developing a new theme I always wrap the_content in a div, like so;

<div class="entry-content">
    <?php the_content();?>

Is there a way I can streamline this process and automatically wrap the_content in a div via a function so I don't always have to manually code it and, more importantly, so if my client ever feels like flexing their coding muscles there wont be a problem if they forget to do it...

share|improve this question

You can hook the_content filter.

paste below code in functions.php :

 function ravs_content_div( $content ){
  return '<div class="entry-content">'.$content.'</div>';

After paste this code in functions.php, the_content() print post/page content after wrap content in div with class entry-content.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.