• Resolved AJ Troxell

    (@phiredesign)


    I have set my home page up to display posts in three columns using the following:
    https://wordpress.pastebin.com/ES2jdRQY
    Yet when I use the same code on a custom page template, it creates three columns, but after placing posts in the first two, it then resorts to posting the remaining posts in the third. It does not complete a column and then kick to the next. I have no clue why it is doing this.
    Here is the code for my “portfolio.php” custom page template:
    https://wordpress.pastebin.com/tTD8tbNU

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    in the home page you have $count = 1; and on the portfolio.php you have $count = 3;. I would put $num_of_posts = $wp_query->post_count;
    after the query (on both template files) for an accurate post count:

    <?php $count = 1;
    $col_count = 3;
    $num_of_posts = $wp_query->post_count;
    $post_per_column = ceil($num_of_posts / $col_count); ?>
    <div id="col1">
    <?php query_posts($query_string . '&cat=-121,-123,-124,-125,-126'); ?>

    like so:

    <div id="col1">
    <?php query_posts($query_string . '&cat=-121,-123,-124,-125,-126'); ?>
    <?php $count = 1;
    $col_count = 3;
    $num_of_posts = $wp_query->post_count;
    $post_per_column = ceil($num_of_posts / $col_count); ?>

    Thread Starter AJ Troxell

    (@phiredesign)

    Wow, that seems to have worked great! Now if only I can get pagination working properly ??
    Thanks a ton!

    Thread Starter AJ Troxell

    (@phiredesign)

    Got pagination working properly! Thanks for the help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘3 Post Columns with query_posts’ is closed to new replies.