WordPress.org

Ready to get started?Download WordPress

Forums

Show special post (2 posts)

  1. Doodlebee
    Member
    Posted 6 years ago #

    Is there a way to take this:

    query_posts('category_name=special_cat&showposts=1');

    and change it to this:

    query_posts('category_name=special_cat&tag_id=10'); ?

    I'm trying to make an archive where the first post stand out. That particular post *must* be of a certain category. I have no problem doing that part, but the other criteria is that it also have a particular tag. If I just have the first example (way up there), it'll show 1 post, but it's always the most recent, even if it's months old. So I'm also trying to sort that a bit further by also looking at the tag - but I just can't seem to get it to go.

    Anyone know what I'm missing? I've tried all kinds of queries and stuff, and just can't make it work. It seems to like one or the other (category name/slug/id or tag name/slug/id), but not both together.

  2. Doodlebee
    Member
    Posted 6 years ago #

    Well, I figured this out, but it's WAY ugly, and way too much code to post here. I know it could be done better, but unfortunately, MySQL isn't my forte. I know enough to get around...and it does work, but its uuuuuugly.

    So I'll just leave an open-ended offer here and say that, if you need something like this, just email me (in fact, I'll probably put it up on my site soon anyway, so you might find it there, too)

    But for reference, what I needed to do what 1) alphabetize posts on my tag archive, 2) the very first post *had* to have a certain category *and* a certain tag associated with it to show properly, but couldn't show up in the remaining (alphabetized) posts, and have different formatting.

    So if anyone needs it, lemme know. (And if anyone who's better at MySQL code than I am feels like they wanna see it to clean it up - email me too!)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.