Tags and Categories

Introduction

The easiest way to determine the exact content of your index is to use tags and/or categories to limit the blog posts which appear there.  There are two main settings available for doing that:

  • Include/exclude posts in these categories
  • Include/exclude posts with these tags

As the names suggest, this is where you can type in the name of any valid categories and tags to restrict the type of blog posts you want in each index. For example, suppose I have a site full of book reviews, and I have already them divided into two main categories: fiction and non-fiction.  I could just create an regular index of all reviews (posts), but the non-fiction reviews would be mixed in with the fiction reviews, making it harder to people to find the reviews they want.  Well, instead I can create two separate indexes, one for each category.  In one I would specify fiction as the include category, and in the other I can specify non-fiction, and the two sets of reviews would be nices separated. Now, suppose I have another site where I blog about all sorts of stuff, but every so often I post a service announcement about the blog, which is of no interest to anyone within a couple of weeks later.  I want an index of all my posts, but I don’t want those boring announcements cluttering up the index.  Fortunately I have already tagged those posts with the tag the boring stuff, and I can use that tag in the index settings to exclude all of them.  I just enter ~the boring stuff into the include/exclude tags field (note the little “not” sign (“~”) in front of the tag name), which tells the index to exclude only the posts with that tag. Note, I can use either the name or the “slug” (the unique internal name) or a tag or category, but it has to be valid.  The settings page will give you back an error if you type in a name or slug that doesn’t exist.

Using Tags

The rules for tags are very simple:

  • If you leave the text box blank, all post are included.
  • If you add one or more tag names or slugs (separated by a commas) to the text box
    tag-1, tag-2

    then the posts included in the index would have the tags:

    WITH (tag-1 OR tag-2)
  • If you add one or more tags names or slugs with the ~ sign in front of them
    ~tag-a, ~tag-b

    then all posts are excluded from the index except those with the tags:

    NOT WITH (tag-a OR tag-b)
  • You can combine the included tags and excluded tags together like this
    tag-1, tag-2, ~tag-a, ~tag-b

    and posts are included in index according to the following rules:

    WITH (tag-1 OR tag-2) AND NOT WITH (tag-a OR tag-b)

The rules for categories are basically the same for tags, but with one extra twist. It is possible to have child categories in WordPress. So you might have a category of book reviews called Non-Fiction and then a series of child categories such as History, Economics, Astronomy, and so on. You can add a post to a child category (e.g. Astronomy) and even though you did not explicitly put it in the Non-Fiction category, it is in there by the fact that Astronomy is a child of the Non-Fiction

Using Categories

Therefore you would assume that if you specified Non-Fiction in the include/exclude categories text box, all the posts categorized in History, Economics, Astronomy, would also show up. But, you would be wrong! By default, posts in the child categories of the categories you entered into the text box are not included. But do not fret, there is an option to include all the child categories in the index too:

  • Include child categories

Here is a summary of the rules for including/excluding categories in the index:

  • If you leave the text box blank, all post are included.
  • If you add one or more tag names or slugs (separated by a commas) to the text box
    cat-1, cat-2

    then the posts included in the index would have the tags:

    IN (cat-1 OR cat-2)
  • If you add one or more tags names or slugs with the ~ sign in front of them
    ~cat-a, ~cat-b

    then all posts are excluded from the index except those with the tags:

    NOT IN (cat-a OR cat-b)
  • You can combine the included tags and excluded tags together like this
    cat-1, cat-2, ~cat-a, ~cat-b

    and posts are included in index according to the following rules:

    IN (cat-1 OR cat-2) AND NOT IN (cat-a OR cat-b)
  • When you have the Include child categories option selected you can do something like this:
    parent-cat, ~child-cat-2

    thus including all posts in parent-cat and its descendant, except for the posts in child-cat-2:

    IN (parent-cat) AND NOT IN (child-cat-2)

Using Tags and Categories Together

There is nothing to stop you from using both tags and categories to determine which posts will appear in your index.  In fact, depending on how you tag and categorize your blog, it can prove extremely useful.  Suppose you have a popular, multi-purpose blog with posts in a wide range of categories and you decide that you want to publish an index of your greatest hits—your most popular posts—in a couple of the categories.  All you need to do is go through the blog and tag each of the posts you want in the index (there are plenty of other plugins to help you do this, like Simple Tags) and then add the tag name into the index settings along with the categories you want.

For example, if you have two categories Politics and Current Affairs you could tag your most popular articles with the popular tag like so:

Categories:
Politics, Current Affairs
Tags:
popular

and the resulting set of posts to be displayed in the index would be calculated as follows:

IN (cat:Politics OR cat:Current Affairs) AND IN (tag:popular)

In general, the following set of categories and tags:

Categories:
cat-1, cat-2, ~cat-a, ~cat-b
Tags:
tag-1, tag2, ~tag-a, ~tagb

results in the following rules being applied to the posts in the index:

(IN (cat-1 OR cat -2) AND NOT IN (cat-a OR cat-b)) AND
(WITH (tag-1 OR tag-2) AND NOT WITH (tag-a OR tag-b))

and don’t forget that child categories could be implicitly included or excluded if you have the Include child categories option selected.

Additional Notes

  • You can type the included and excluded tag and category names in any order.  The results will be always be the same.
  • You can use the category or tag’s slug name instead, but the next time you open the settings page, you will see the titles, not the slugs.
  • I have recently noticed that there is a problem with tag and category names with a comma in them.  Because commas are used by the plugin to separate the terms, if you try to add a name that has a comma, the plugin will refuse to accept it.  The work around (for now) is to use the slug name instead since they never have commas.  You can find out the slug of a tag or category by going to Posts » Tags and Posts » Categories respectively.  Note: you will have to do this every time you edit the settings for the index (until the problem is fixed, anyway), so try to avoid using tag and category names with commas in your index settings, if you can.
  • If you are sorting the index by tags or categories, there are some more inclusion/exclusion rules to be aware of in some cases.  Please see the Sorting page for more details.
  • If you want to have an index of pages in your blog, but want to use tags to include or exclude some of them, you can add tags to pages using Simple Tags or other plugins that add tagging to pages.
  • If you delete a tag or category that’s being used in an index, the next time you edit the settings if you see an error message informing you that the settings are no longer valid.
  • AZIndex stores tags and categories using their internal term ids, so renaming tags or categories will not affect the operation of index since the term ids will not change.

No comments yet to

  • Thank you very much for your site. It is very important to me. Thank you.

  • Hi there, I discovered your blog via Google even as looking for a related topic, your web site got here up, it looks great. I’ve bookmarked it in my google bookmarks.

  • betting bonus at bettingbonuses.biz

  • Hey i think your blog is fantastic! I found it on Google. I think i will come back one day soon.

  • What’s Going down i’m new to this, I stumbled upon this I have discovered It positively helpful and it has aided me out loads. I hope to give a contribution & help other users like its helped me. Great job.

  • I’m right there with you, although I would read anything she writes, the cover is definitely intruiging!

  • You know that anything goes once you pick up a work by the zany and terrific Kurt Vonnegut. The man knows how to dish up satire like none other. He’ll spew out his complaints about the government, the world, people, etc., and instead of making it sound like a bunch of inane ranting he uses all of that to create a crazy world filled with outrageous characters and situations. “Breakfast of Champions” is an off-the-wall novel that is about 300 pages of pure hilarity and comedic chaos. Some of the most outrageous characters lie within this masterpiece.Listen: This story revolves mainly around two characters. There’s Kilgore Trout who is an aging and bitter sci-fi writer that nobody has ever heard of (except for one person). His stories have only appeared in very adult magazines. So naturally, he has “doodley-squat” to show for it. The other person that this story is about is a car dealer by the name of Dwayne Hoover, a man that everyone in town considers a “fabulously well-to-do” person. Dwayne is losing his mind and is ever so gracefully slipping into the cozy and wonderful world of insanity. What pushes him over the edge will take place when the two meet and Hoover takes one of Trout’s literary works as reality. The results are unforgettable and hilariously disturbing in this dark and offbeat tale of the flawed human beings who are destroying Mother Earth.

  • Wow good info, thank you. This is what i looking for.

  • More like: The cost of implementing “”"proper”"” security against unmitigated and unreasonable to expect attacks outweigh the benefits, when out contacts will indemnify us anyway. You know why they don’t bother? One, they expect that a person won’t be able to access the equipment without being caught, or won’t risk breaking and entering or other criminal charges to get at best, free laundry. Minimal payout = less incentive to attack, less reason to care.

  • Interesting….
    How did you get the image inside the QR?
    This is all new to me, so I have been googling and reading up as much as possible…

  • Howdy. Very cool website!! Guy .. Beautiful .. Wonderful .. I’ll bookmark your site and take the feeds also…I’m happy to locate numerous helpful info here within the post. Thank you for sharing.

  • I’ve been exploring for a little bit for any high quality articles or blog posts in this sort of space . Exploring in Yahoo I at last stumbled upon this website. Reading this info So i am satisfied to exhibit that I’ve an incredibly good uncanny feeling I found out exactly what I needed. I so much unquestionably will make certain to do not disregard this website and give it a glance regularly.

  • I was just looking for this info for a while. After 6 hours of continuous Googleing, finally I got it in your site. I wonder what’s the lack of Google strategy that do not rank this kind of informative web sites in top of the list. Generally the top web sites are full of garbage.

  • I want to display list of post in category page using AZindex. So I’ve created a category template. Now I need help to display posts list by category there. For instance, when I’ll go to domain.com/category/health, the page should display only post list from health category using azindex. Is it possible? I need your help.

  • I’ve recently started a web site, the info you offer on this site has helped me greatly. Thanks for all of your time & work.

  • I am love this . but can u tell me how to remove points front of the main latter …. Plz visit this link http://www.hostmp4.com/all-movies or tell me how i do that…

  • I’d should verify with you here. Which is not one thing I often do! I enjoy studying a submit that will make individuals think. Also, thanks for allowing me to remark!

  • Excellent read, I just passed this onto a colleague who was doing some research on that. And he just bought me lunch since I found it for him smile Therefore let me rephrase that: Thank you for lunch!

  • It’s actually a nice and helpful piece of information. I am glad that you just shared this helpful information with us. Please stay us informed like this. Thank you for sharing.

  • Browse all brands of best vacuum cleaner today.