Grow your CSS skills. Land your dream job.

help with wordpress categories

  • # March 28, 2009 at 4:01 pm

    I have been googling the crap out of this for two hours without much luck. Here is what I need

    I have a tabbed content box with three tabs. I want to make three categories in the content box. One category for each tab. That way the user can make a post in wordpress to a specific category and have it automatically show up in the content box under that tab. This content box is on the homepage. I have been able to get the categories to show up, but it shows all of them no matter what category you post in. I want to show the category, title with permalink and the_excerpt() of the post made to that category. I am using this code to prevent the category from showing up in the homepage regualar posting area

    Code:
    if (is_home()) {
    query_posts(“cat=-24,-25,-26″);
    }
    ?>

    got any idea’s. This would make an excellent blog post or tutorial since there does not seem to be an easy to find solution online.

    # March 28, 2009 at 4:24 pm

    How about Simple Pie?

    Pull in your own RSS feed and then filter out what you don’t want.

    Chris has a vid on Simple pie here: http://css-tricks.com/video-screencasts/55-adding-rss-content-with-simplepie/

    And if memory serves he covered using your own feed in this one: http://css-tricks.com/video-screencasts/41-wordpress-as-a-cms/

    Rob
    # March 28, 2009 at 4:26 pm

    this little explanation helped me a lot..

    http://perishablepress.com/press/2008/0 … wordpress/

    You might have found it already though…

    # March 28, 2009 at 4:35 pm

    simple pie won’t work. I am trying to get my category posts to show in one specific area, So that the person that will be doing the updating can just post to that category and it will show in the right spot. Still no luck.

    # March 28, 2009 at 4:58 pm
    Quote:
    simple pie won’t work.

    Why not?
    It shows up where you tell it to.

    # March 28, 2009 at 5:18 pm

    will simple pie split up the categories into 3 different categories and show them in the spot I want them to. Usually rss shows all the posts. I don’t want the entire post to show, I want the title and the_excerpt(). I don’t know if simple pie will do that.

    # March 28, 2009 at 6:17 pm

    It would appear that I found the answer to the problem. That is to make your own loop. You can re use the wordpress loop.

    Here is the code I am going with right now

    I made a blog.php in there I made my loop to connect to the blog category

    Code:
    < ?php $recentPost = new WP_Query();
    $recentPost->query(‘cat=26′);

    ?>

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

  • ” rel=”bookmark”>< ?php the_title(); ?>
  • < ?php the_excerpt(); ?>
    “>continue reading
    < ?php edit_post_link('Edit', '

    ‘, ‘‘); ?>
    < ?php endwhile; ?>

I am making edits to the code to show the edit post button, view previous and next or older posts. things like that. But I now have three tabs working, with three different categories and they do not interfere with the homepage posting. I also added

Code:
< ?php if (is_home()) {
query_posts("cat=-24,-25,-26");
}
?>

to the homepage loop. so that the posts won’t show up there.

# March 28, 2009 at 6:27 pm

Ok, glad you found what you needed. :)

Seems with Simple Pie you can only get the description and not the excerpt.

# March 28, 2009 at 7:46 pm
Code:
< ?php query_posts('category_name=CATEGORY-SLUG&showposts=1'); ?>

< ?php while (have_posts()) : the_post(); ?>
< ?php the_title(); ?>
< ?php the_excerpt(); ?>
< ?php endwhile; ?>

Do that for each of the three categories?

# March 28, 2009 at 9:37 pm

I gave it a try and it doesn’t work. The content box that I am showing the category posts in are on the homepage. With the code you put up, it kills the posts in the homepage. With this code, it doesn’t.

# March 28, 2009 at 9:38 pm

The only problem I am having now is that I can’t figure out how to get the next and previous buttons working with the code. It errors on the endif.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".