WordPress.org

Ready to get started?Download WordPress

Forums

Six posts per page, in two custom columns (5 posts)

  1. niski
    Member
    Posted 2 years ago #

    Hello. I'll be so grateful if anyone could tell me how to display posts in two different columns with one, common pagination. The link (picture) below describes precisely what I want to implement im my own theme.

    http://mg.idl.pl/scheme.png

    Thanks in advance ;)

    PS.
    I'm using version 3.4.1

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    the easiest way might to use the $wp_query->current_post variable in a conditional statement, to show the posts different;

    example:

    <?php
    if( have_posts() ) : while( have_posts() ) : the_post();
    
    if( $wp_query->current_post <=2 ) { ?>
    output for each of the first three posts
    <?php } else { ?>
    output for each of the next three posts
    <?php } ?>
    
    endwhile;
    else : echo 'no posts';
    endif;
    ?>

    what is the 'next/prev posts page' supposed to show?
    same layout or just the block layout for the 'next three posts'?

  3. niski
    Member
    Posted 2 years ago #

    The layout will remain without any changes after choosing another page. The first three posts wouldn't be the most recent but the latest among those next six news.

    I haven't got any experience with WP ;)

  4. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    The layout will remain without any changes after choosing another page.

    then the suggested code should work.

    what else do you need to know?

    what theme are you using as base for your customisations?

    some links:
    http://codex.wordpress.org/Theme_Development
    http://codex.wordpress.org/The_Loop
    http://codex.wordpress.org/Function_Reference/the_post_thumbnail

  5. niski
    Member
    Posted 2 years ago #

    In some way, it seems working properly. In addition, would you be so kind and show me how to implement pagination into your above code? ;)

    I've forgotten. I don't know why but thumbnails don't work. I made everything correct. I wrote those two lines in functions.php

    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 214, 214, true );

    Now, I have visible "Featured Image" in admin panel. I set a few images but they aren't shown in my theme. What may be a reason of that?

    <?php
    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
    the_post_thumbnail();
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic