• Hey,

    Im working on a WP theme and it requires me to get posts to show up in two different sizes on the front page. A screenshot will make this easier to understand: https://imgur.com/dBvB6

    Please help me with this ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • This can normally be done using widgets. Look for “recent posts with excerpts” – you might have to do some code modification to get it to do exactly what you want it to do, but that should get you started.

    Thread Starter xMarra

    (@xmarra)

    I don’t understand how that will fix my problem. That is a sidebar widget, how do I use it in the loop?

    I would do this with 2 loops.

    The first would query just 1 post and show it with appropriate CSS styles.

    <?php query_posts('showposts=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    your stuff here
    <?php endwhile; ?><?php endwhile; endif; ?>

    The second would skip the first post

    <?php query_posts('posts_per_page=4&offset=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    your stuff here
    <?php endwhile; ?><?php endwhile; endif; ?>

    Thread Starter xMarra

    (@xmarra)

    Thanks for helping.

    But when I try your code the page just goes blank. Here is my code:

    <div id="articleContainer">
    		<?php query_posts('showposts=1'); ?>
    		<?php while (have_posts()) : the_post(); ?>
    			<article id="bigPost" <?php post_class() ?> id="post-<?php the_ID(); ?>">
    				<!-- check if the post has a Post Thumbnail assigned to it. -->
    				<a href="<?php the_permalink() ?>"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail('bigThumb'); } ?></a>
    				<div class="postItems">
                    	<h2 class="bigTitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
                        <div class="entry">
                        	 <?php the_content(); ?>
                        </div>
                        <div class="postMetaData">
                            <span id="meta" class="time"> <?php the_time('d/m/Y  g:ia') ?></span>
                            <span id="meta" class="comments"><?php comments_number( 'Ingen kommentarer', 'én kommentar', '% kommentarer' ); ?>.</span>
                            <span id="meta" class="category">Kategori: <?php the_category(', ') ?></span>
                        </div>
                	</div>
    			</article> <!-- end bigPost -->
    		<?php endwhile; ?><?php endwhile; endif; ?>
     </div> <!-- end articleContainer -->
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Posts in multiple collumns’ is closed to new replies.