How to wrap the_content() in a div with a class
-
Hi!
I am trying to wrap the_content(); in a div so that I can style it using css so that each post is next to each other, ending up in a two column layout situation.
This is what I have tried in my code:
<div class="entry-content"> <h1><?php the_title(); ?> </h1> <?php query_posts('cat=5&posts_per_page=4'); if (have_posts()) : while (have_posts()) : the_post();?> <h2><?php the_title();?></h2> <?php global $more; $more = 0; <div class="two-col">the_content();</div> endwhile; endif; // Reset Query wp_reset_query(); ?> </div>
<div class="entry-content"> <h1><?php the_title(); ?> </h1> <?php query_posts('cat=5&posts_per_page=4'); if (have_posts()) : while (have_posts()) : the_post();?> <h2><?php the_title();?></h2> <?php global $more; $more = 0; '<div class="two-col">' . the_content(); . '</div>' endwhile; endif; // Reset Query wp_reset_query(); ?> </div>
Dreamweaver immediately pics up that there is an issue with the formatting of the syntax so clearly this is where I am going wrong. If someone would be so kind as to show me what I am doing wrong, I would appreciate!
Many thanks.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to wrap the_content() in a div with a class’ is closed to new replies.