WordPress.org

Ready to get started?Download WordPress

Forums

3 category 3 column code (2 posts)

  1. jrbadger
    Member
    Posted 4 years ago #

    this is code i've stolen from perishable press and adjusted using the code used in web-minimalist-200901 style.css for categories.

    why isn't it working?

    <body>
    // FIRST LOOP: show most recent post from category david
    <div id="column_01">
    <?php query_posts('cat=david&showposts=1'); ?>
    <?php $posts = get_posts('category=david&numberposts=1&offset=0');
    foreach ($posts as $post) : start_wp(); ?>

    <?php the_title(); ?>
    <?php the_content(); ?>

    <?php endforeach; ?>
    </div>

    // SECOND LOOP: show most recent post from category michael
    <div id="column_wrap">
    <div id="column_02>
    <?php query_posts('cat=michael&showposts=1'); ?>
    <?php $posts = get_posts('category=michael&numberposts=1&offset=0');
    foreach ($posts as $post) : start_wp(); ?>

    <?php the_title(); ?>
    <?php the_content(); ?>

    <?php endforeach; ?>
    </div>

    // THIRD LOOP: show most recent post from category julian
    <div id="column_3">
    <?php query_posts('cat=julian&showposts=1'); ?>
    <?php $posts = get_posts('category=julian&numberposts=1&offset=0');
    foreach ($posts as $post) : start_wp(); ?>

    <?php the_title(); ?>
    <?php the_content(); ?>

    <?php endforeach; ?>
    <div id="column_01">
    </div>
    </div>

    /* three column layout */
    div#column_01 {
    float: left;
    clear: none;
    width: 30%;
    border: thin solid red;
    }
    div#column_wrap {
    float: right;
    clear: none;
    width: 60%;
    border: thin solid red;
    }
    div#column_02 {
    float: left;
    clear: none;
    width: 45%;
    border: thin solid red;
    }
    div#column_03 {
    float: right;
    clear: none;
    width: 45%;
    border: thin solid red;
    }

    </body>

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

    what is not working?

    without a more accurate error description, this help is guesswork.

    is all this code in style.css?
    if so, there are major things wrong.

    most of it is html and php code, which is not allowed in a css file. the html/php part of the code should probably be part of the index.php file of a theme.

    link to your site?

Topic Closed

This topic has been closed to new replies.

About this Topic