• Resolved ijon

    (@ijon)


    Hello,

    There is my problem: I’m trying to create a wp theme. On the main page, I’d like to display the latest blog post AND the latest project.
    I figured it would be easier to try display one category in the main content are, and the other category in the sidebar.

    Obviously, this is not working. Can someone help me with this and tell me what would be the proper code to active such thing ?

    I’ve already tried some articles on codex.www.ads-software.com, but I get confused…

    Thank you so much for your help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Dhikra

    (@dhikra)

    It’s not impossible to display one category in the main content, and another in the sidebar, but it’s not going to look good, if you ask me.
    You should just divide the main content in two columns, if that’s what you’re trying to do.
    You can easily use divs and style them in your style.css file.

    Thread Starter ijon

    (@ijon)

    Dhikra,
    Thank you for your quick answer

    I was just thinking the exact same thing…, I just did that… And yes, it is exactly what I’m trying to do…

    Now, what do I have to do to get Category 1 in the left column and Category 2 in the right column ?

    Thank you again!

    Dhikra

    (@dhikra)

    Thread Starter ijon

    (@ijon)

    Thank you,

    I’ve already read that page, but it seems I’m doing something wrong, because, when I publish a new post in one category or the other, both columns are refreshed with the same article… this is driving me crazy… ??

    Here, are the two options I tried so far (one in the main-content and the other in the aside)… None of these worked. Can you take a look and tell me what I’m doing wrong?
    THANK YOU again, I appreciate…

    <div id=”wrapper”>

    <?php get_header(); ?>

    <div class=”divider”></div>
    <div id=”main-content”>

    <?php
    query_posts(‘cat=News’)
    ?>

    <?php while (have_posts()) : the_post(); ?>

    <h2>“><?php the_title(); ?></h2>

    <div class=”index-entry”>

    <div class=”index-blog-image” style=”width: 200px; height: 200px; float: right;”>
    <?php
    if ( has_post_thumbnail() )
    the_post_thumbnail(‘thumbnail’) ;?>
    </div><!–END index-blog-image–>

    <div class=”index-blog-post”>
    <?php the_excerpt(); ?>
    </div><!–END index-blog-post–>

    </div><!–END index-entry–>

    <?php endwhile; ?>

    <?php wp_reset_query ();?>
    </div><!–END main-content–>

    <aside>

    <?php
    $recentPosts = new WP_Query ();
    $recentPosts->query(‘showposts=1&cat=-News’)
    ?>

    <?php while ($recentPosts->have_posts()) : $recentPosts-> the_post(); ?>

    <div <?php post_class() ?> id=”post-<?php the_ID(); ?>”>

    <h2>“><?php the_title(); ?></h2>

    <div class=”index-entry”>

    <div class=”index-portfolio-image” style=”width: 200px; height: 200px; float: left;”>
    <?php
    if ( has_post_thumbnail() )
    the_post_thumbnail(‘thumbnail’) ;?>
    </div><!–END blog image–>

    <div class=”index-blog-post”>
    <?php the_excerpt(); ?>
    </div><!–END blog-post–>
    </div><!–END index-entry–>
    </div><!–END Post–>

    <?php endwhile; ?>

    <?php wp_reset_query ();?>

    </aside><!–END aside–>

    Dhikra

    (@dhikra)

    Try using the category id, not the name.

    Thread Starter ijon

    (@ijon)

    Just tried… Not working either… I don’t get it

    Thread Starter ijon

    (@ijon)

    Ok, Got it…

    Just had to try “category_name”…
    Seems to be working…

    Thank you for your help…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘One category in content one in sidebar’ is closed to new replies.