WordPress.org

Ready to get started?Download WordPress

Forums

how to display posts from a category into two columns? (2 posts)

  1. João
    Member
    Posted 1 year ago #

    to display the posts, I use that function that pulls only a specific category:

    " <?php query_posts("showposts=5&cat=1");
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    etc etc etc

    <?php endwhile; else: ?>
    <?php endif; ?> "

    then what's the problem?
    I need to display 10 posts in 2 columns, only this same category

    when I do a php page in regular use in the query so I

    Column 1> SELECT * FROM noticias_dados where idcat = '$ idcat' order by id desc LIMIT 0.5

    column 2> ​​SELECT * FROM noticias_dados where idcat = '$ idcat' order by id desc LIMIT 5.5

    then shows the top 5 in column 1 and 6-10 in column 2, how to do this in wordpress?

  2. p5systems
    Member
    Posted 1 year ago #

    You can use same function <?php query_posts("showposts=10&cat=1");
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    to control the limit of images using the css control.

    <div class="main">
    <div class="img1">
    </div>
    </div>
    .main { width:600px;}
    .img1 { width:300px; } . ------ column width
    just add the full width for .main class
    add prefered width of column for img1, so that we can display two columns.

    thanks
    P5systems

    <?php endwhile; else: ?>
    <?php endif; ?> "

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.