• Resolved mr.cello

    (@mrcello-1)


    hello,
    i need to wrap every post i call in the sidebar in a div, so i can style better

    now i have written this code (please dont kill me im a webdesigner)

    <div id="sidebar" class="grid_4 omega">
    	<div id="recent-post-widget">
    		<?php	$the_query = new WP_Query( 'category_name=news'  ); ?>
    		<div class="post-content">
    			<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    			<?php remove_filter('the_excerpt', 'wpautop'); ?>
    			<?php if( has_post_thumbnail() ) {?>
    			<p class="post-thumb"> <a href="<?php the_permalink(); ?>"> <img class="grid_4 alpha omega" src="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID)); ?>"/> </a> </p>
    			<?php }  ?>
    			<p class="post-date">
    				<?php the_date('j F Y');  ?>
    			</p>
    			<p class="post-title"> <a href="<?php the_permalink(); ?>">
    				<?php the_title();  ?>
    				</a> </p>
    			<p class="post-excerpt">
    				<?php the_excerpt();  ?>
    			</p>
    			<?php endwhile; ?>
    		</div>
    		<?php wp_reset_postdata();?>
    	</div>
    </div>

    BUT, it wrap all the posts in a single div….
    sorry for the HERESY

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘wrap posts into div’ is closed to new replies.