WordPress.org

Ready to get started?Download WordPress

Forums

How can you make a frontpage with these ingridients? (3 posts)

  1. fkaf
    Member
    Posted 4 years ago #

    A few posts from 2 categoreies ( side by side)
    a field with a list and a changing photo to the right

    So far I`ve mangaged to make a page template for pageofposts
    consisting of posts from 1 cat side by side. But how can I do the rest above. Lists in posts ( html) or directly in the pageofpost templete?

    Also what happens the day you have to upgrade a theme when you?ve done lots of modifications?

  2. fkaf
    Member
    Posted 4 years ago #

    Anyone
    When I see websites with often a frontpage with 4-5 elements,
    one post, a list asnd so on. Is this different posts or what?

    How do I make a post with content and a list for more posts in the same categori?

  3. vtxyzzy
    Member
    Posted 4 years ago #

    I think what you want is a template with multiple queries/loops. You would use one query to get the category for the left colmun, a second for the category for the right column, and possibly a third to get the list.

    The Codex has an example of Multiple Loops In Action. That example only uses one query with two loops. Since you want two different categories, you would need at least two queries. Below is a modified version of the Codex example:

    <div class="leftcolumn">
    <?php $my_query = new WP_Query('category_name=cat1&posts_per_page=2');
    if ($my_query->have_posts()) :  while ($my_query->have_posts()) : $my_query->the_post();
        <!-- Display a post in the left column... -->
      <?php endwhile; ?>
    </div> <!-- End of leftcolumn -->
    <div class="rightcolumn">
    <?php $my_query = new WP_Query('category_name=cat2&posts_per_page=2');
    if ($my_query->have_posts()) :  while ($my_query->have_posts()) : $my_query->the_post();
       <!-- Display a post in the right column -->
    <?php endwhile; endif; ?>
    </div> <!-- End of rightcolumn -->
    <div class="clear">
    <div class="listofposts">
    <?php $my_query = new WP_Query('category_name=cat1&posts_per_page=10');
    if ($my_query->have_posts()) :  while ($my_query->have_posts()) : $my_query->the_post();
       <!-- Display a post in the list box -->
    <?php endwhile; endif; ?>
    </div> <!-- End of listofposts -->

Topic Closed

This topic has been closed to new replies.

About this Topic