WordPress.org

Forums

Advanced Layout : Is this possible? (24 posts)

  1. astereo
    Member
    Posted 9 years ago #

    I've been modding up WordPress like crazy to get my site finished. My layout looks like this:

    http://www.devlounge.net/wordpress/test

    What i want to do is, in the four blocks under "Lastest Articles & Interviews", be able to pull the most recent from my articles and interviews category, but have them seperated into one post excerpt per column.

    (Example: Call recent posts (in this case, 4, one for each column, and spread them across all four divs. So maybe, the first block would have a title, and a very small excerpt under it. In the next block, it would continue showing the next most recent from category "x")

    I don't know if it's possible to do this, but if it is, can someone please explain.

  2. spencerp
    Member
    Posted 9 years ago #

    I just want to say: OMFG! That is sweet man! And especially congrats on it, because that's a pretty dang good modification of the Default theme. =^) Awesome work!

    spencerp

  3. moshu
    Member
    Posted 9 years ago #

    I have probably seen similar solutions but let me clarify a few things before I attempt to direct you toward some solutions posted here or in other places.

    The top. Will that "News" part always be populated exclusively from the "news' category?
    Middle. Under "Lastest Articles & Interviews" will you have only posts from certain categories (e.g. articles and interviews) or from more categories? (And I assume the news items should be excluded, too - right?)

  4. astereo
    Member
    Posted 9 years ago #

    @moshu: Yeah exactly. The new will only come from my "Homepage News" category, while Articles and Interviews will come from their corresponding catergories, and any other posts from other catergories would be excluded. If you can provide me with how to do this, that'd be great.

    @spencerp: Thanks for the comments :)

  5. Dgold
    Member
    Posted 9 years ago #

    I like the "advanced" design type.
    But there's something weird here
    http://www.devlounge.net/wordpress/interviews/interview-matt-brett
    when I refresh sometimes there's a background graphic near the top that interrputs the headline & side menu.

  6. moshu
    Member
    Posted 9 years ago #

    @astereo,
    Probably the "multiple loops" is the answer for your question. Eventually, if needed, combined with query_posts.
    So, basically, the first Loop would call posts only from cat "news" and the second one only from cats interview & articles.
    Then what exactly is shown (title, excerpt etc.) is up to you, and you just have to format that div to display those 4 posts aligned one next to the other.

    Eventually, you can wait a bit, maybe more knowledgable coders will jump in :)

  7. moshu
    Member
    Posted 9 years ago #

    Ah, getting old... forgetting what I wanted to add.
    If you want a total separation by categories - you can also take a look at this thread:
    http://wordpress.org/support/topic/38046?replies=31
    though that one doesn't address the different layout.

  8. astereo
    Member
    Posted 9 years ago #

    Thanks moshu. I'll look into it.

    Dgold, what browser are you using so I can try to sort it out.

  9. talgalili
    Member
    Posted 9 years ago #

    very well designed website,

    If it will teach how to build it - I am registering now :)

  10. astereo
    Member
    Posted 9 years ago #

    @talgalil - Yeah, I'm going to do an article on customizing WP in the near future.

    As of right now, I've almost got it.
    I want the four boxes to pull posts the 2 most recent posts from Articles & Interviews like this:

    Article | Interview | Article | Interview

    Using the Multiple Loops, I used "Multiple Loops in Action" to put together the columns. It calls the 1st two columns fine, but on the last two, when it calls the 2nd most recent post for Article and Interviews, it's pulling from the Homepage news category.

    How code i change

    <?php if (have_posts()) : while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    <!-- Do stuff... -->
    <?php endwhile; endif; ?>

    to pull one from Articles, and one from Interviews without repeating the first post?

    Thanks! :)

  11. moshu
    Member
    Posted 9 years ago #

    Unfortunately, I am not a coder... just a kind of "traffic dispatcher" in the middle of a traffic jam :)
    Maybe you can get some ideas from this thread:
    http://wordpress.org/support/topic/66516?replies=8

  12. Chris_K
    Member
    Posted 9 years ago #

  13. astereo
    Member
    Posted 9 years ago #

    Thanks for the links guys. I still can't figure this out. Figures, cuz its just about the last thing I have to do besides some more css tweaks.

    If any coder knows a solution, please let me know.
    Regards! :)

  14. astereo
    Member
    Posted 9 years ago #

    Still hoping for some help :)

  15. Dgold
    Member
    Posted 9 years ago #

    @astereo -- sidenote on the problem I saw on the Single article page... It's not happening now,maybe you fixed. I used Firefox 1.5. It was the colorful footer graphic jumping up to the top after Refresh. Not happening now.

  16. cre8d
    Member
    Posted 9 years ago #

    Hi astereo,

    If my tutorial didn't help, feel free to leave a comment there and I'll see if I can put my tutorial into your context.

    Cheers
    Rachel

  17. moshu
    Member
    Posted 9 years ago #

    Hey, Rachel, your tutorial doesn't say anything about this situation when you have category A and B, both have 2 posts and you want to display them, like
    A1 B1 A2 B2

  18. cre8d
    Member
    Posted 9 years ago #

    Ahh - I read the top question (which would work perfectly with my tutorial) but didn't notice the extra detail mentioning the alternating.

    Off the top of my head, couldn't you just pull out the 2 most recent posts from each category, storing them in variables, then displaying them in the correct order afterwards?

  19. Kafkaesqui

    Posted 9 years ago #

    I was asked to add something to the discussion, and this is the best I can work out on short notice...

    First, set up different query classes for the (2) posts in each category:

    <?php
    $article = new WP_Query('category_name=Articles&showposts=2');
    $interview = new WP_Query('category_name=Interviews&showposts=2');
    ?>

    Then in each column, just add a call to the_posts() through your new classes, alternating each time, before using any regular template tags:

    <?php $article->the_post(); ?>
    ~ article 1 here ~
    <?php $interview->the_post(); ?>
    ~ interview 1 here ~
    <?php $article->the_post(); ?>
    ~ article 2 here ~
    <?php $interview->the_post(); ?>
    ~ interview 2 here ~

    the_post() will (or should) handle the step through to the following post in each category automatically. No true loop functionality here, but this should work for you.

  20. astereo
    Member
    Posted 9 years ago #

    Great, I'll try working with it in the morning and let you know how it goes.

  21. davidchait
    Member
    Posted 9 years ago #

    Kafka beat me to it, but a slightly different solution.

    Do your two loops, but put the output into arrays. this is pseudocode, obviously!

    $outstuff = array();

    $i = 0;
    loop1 (articles)... {
    $outstuff[$i] .= content for this post...
    $i += 2;
    }
    $i = 1;
    loop2 (interviews)... {
    $outstuff[$i] .= content for this post...
    $i += 2;
    }

    for ($i=0; $i<4; $i++)
    echo $outstuff[$i];

    ... etc.

    In many cases, easier to pre-cache the output stuff.

    Note, if the thing becomes a real bear, you could use PHP's output buffering system to catch the WP functions that echo directly, and capture each post's output along the way. Then order/reorder as you see fit.

    -d

  22. Kafkaesqui

    Posted 9 years ago #

    David, when I read through the thread my original starting thought on how to accomplish this wasn't far off from your solution, and if I was doing the actual work I'd probably go with it considering the greater flexibility it allows. But then the little idea above came to mind, and I figured: Hey why not, it's simple. ;)

  23. astereo
    Member
    Posted 9 years ago #

    David, I not much of a coder, so could you explain how I'd put it all together?

    Thanks, sorry to keep bugging you guys!

  24. gMk
    Member
    Posted 9 years ago #

    Check out the customizable post listings plugin - makes for easy manipulation of various categories and posts

    http://www.coffee2code.com/archives/2004/08/27/plugin-customizable-post-listings/

Topic Closed

This topic has been closed to new replies.

About this Topic