WordPress.org

Ready to get started?Download WordPress

Forums

Posts in multiple collumns (5 posts)

  1. xMarra
    Member
    Posted 1 year ago #

    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: http://imgur.com/dBvB6

    Please help me with this :)

  2. david.bailey
    Member
    Posted 1 year ago #

    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.

  3. xMarra
    Member
    Posted 1 year ago #

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

  4. mrspabs
    Member
    Posted 1 year ago #

    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; ?>
  5. xMarra
    Member
    Posted 1 year ago #

    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 -->

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.