WordPress.org

Ready to get started?Download WordPress

Forums

Feed in recent blog posts BY TAG with The Loop on homepage (7 posts)

  1. nate22
    Member
    Posted 3 years ago #

    I would like to create 4 tag categories for PAGES (not posts):

    Bedrooms, Bathrooms, Livingrooms, Kitchens

    I would like to bring the most recently posted article for each tagged item onto the front page using The Loop.

    This way, the front page is always updated with the latest article about each topic.

    I know there has got to be some way to do it, but I'm very new to WP.

  2. Why do they have to be pages and not posts, or Custom Post Types?

  3. nate22
    Member
    Posted 3 years ago #

    The blog is going to be separate. Also, there won't be comments or any other bloggy type stuff on these pages, so it is easier just to treat them as pages (I think).

    It especially seems easier for a person to easily distinguish which are pages and which are blogposts since the admin panel separates Pages and Posts. With custom post types, I think it would be a lot more complicated. Is there some advantage to that I'm missing or where you just curious?

  4. nate22
    Member
    Posted 3 years ago #

    Or should I be using category templates and somehow include an if else statement in the loop something like...

    <?php if (is_category('1')) { ?>
    [some code to import most recent post to this category]
    <?php } elseif (is_category('2)) { ?>
    [some code to import most recent post to this category]
    <?php if (is_category('3')) { ?>
    [some code to import most recent post to this category]
    <?php } elseif (is_category('4)) { ?>
    [some code to import most recent post to this category]
    <?php } ?>

    [Please post code snippets between backticks or use the code button.]

    I really am not familiar with how categories work at all, but that seems like it might be a solution, too.

  5. The blog is going to be separate. Also, there won't be comments or any other bloggy type stuff on these pages, so it is easier just to treat them as pages (I think).

    You can TOTALLY do that with Custom Post Types.

    http://kovshenin.com/archives/custom-post-types-in-wordpress-3-0/
    http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress

  6. nate22
    Member
    Posted 3 years ago #

    THANK YOU! I am lucky you happened to be around! You just saved me several hours if not days of experimenting.

  7. nate22
    Member
    Posted 3 years ago #

    Actually I don't see how custom posts can do what I need at all. Categories might work...

    I would think I need to have something like this, actually:

    <?php while (have_posts()) : the_post(); ?>
    <?php query_posts("posts_per_page=1&cat=7"); ?>
    <?php endwhile; ?>

    I have no idea how the F to code properly, of course, but posts_per_page=1&cat=7 is my way of thinking to tell WP to grab the LAST post of CATEGORY 7 and spit it out. Perhaps there needs to be an echo or who knows what, but this ain't working.

    Can you tell me how to properly code that?

Topic Closed

This topic has been closed to new replies.

About this Topic