ThemeShaper Forums » Thematic

[closed]

is it possible organize some posts alphabetically, others by date?

(7 posts)
  • Started 3 years ago by onelittlemoose
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. onelittlemoose
    Member

    I'm looking for some direction before undertaking this... insights welcome.

    I'm building a site that is going to be mainly a directory, but with an option for blogging. So far the directory has 5 categories, and those will each have at least 4 subcategories. I would want these to be organized alphabetically. I would also not want any of these posts to appear on the home page, even if they are the most recent.

    For the blog part, my thinking is to have this as a separate category, with subcategories as needed. These posts I would want to organize by date. In turn, these are the ones I would want to appear on the home page, although there may not be any of these posts to start with.

    So,
    1) is this possible, to have some categories organized by date, others alphabetically?
    2) if it is possible, is this a stupid idea? Is organizing the difference based on categories the right way to do it? And where do I start?

    Not looking for the full code, but looking for direction and insight. I'd like to figure out how to do this, assuming it's not fraught with issues, because I think there will be a few other sites I build this way as well.

    Many thanks.

    Posted 3 years ago #
  2. onelittlemoose
    Member

    Very cool. I think this is what I am looking for. Problem solved for now, although I will probably be back as I try to bumble through it.

    Thanks!

    Posted 3 years ago #
  3. onelittlemoose
    Member

    I fear I've run into a wall. Baffled. Going with custom query here in the codex
    http://codex.wordpress.org/Custom_Queries#Display_Order_and_Post_Count_Limit

    In general, the concept makes sense, but I get caught on the specifics.

    I've also read the preamble. My first question how does the global variable $gloss_category know which category it refers to? Would I need to add a category in the admin section called "gloss" or "gloss_category"? Or is that global variable defined previously in the plugin they refer to? And does that mean I need to write a plugin first? (I hope not)

    Would I also need to "hook" it somewhere in a way specific to thematic?

    I have more questions that lead to more bafflement, but let's start with this. Baby steps.

    Much thanks.

    Posted 3 years ago #
  4. "For our first example, let's consider a glossary plugin that will let the site owner put posts in a specific "glossary" category (saved by the plugin in global variable $gloss_category). "

    which is saying that somewhere in the plugin settings (b/c this example presumes a plugin) this variable is defined. if you aren't writing a plugin, you can simply define the variable right there ($gloss_category = 'bacon') or eliminate it completely. for instance:

    if( is_category( 'bacon' )) {
         // alphabetical order by post title
         return "post_title ASC";
      }

    which will only effect the bacon category.

    Posted 3 years ago #
  5. onelittlemoose
    Member

    That's a relief, that I don't have to write a plugin.

    Now here's my next question: in my case there are multiple categories that I want to organize alphabetically. About 15 at the moment, likely more to add (it's a directory). Would it make sense to pile those categories up into one variable - it think that's called an "array"? (don't know how to do that yet, but working thru the logic)

    Many thanks.

    Posted 3 years ago #
  6. you functions.php is a plugin of sorts. it interacts with the WP core as well as with thematic. it was only meant as example code.

    yes, storing a group of data into 1 variable is an array and in your case would be more efficient/elegant than any other way of coding it. you can see that is_category() does accept an array in the Codex. SO much information there

    http://codex.wordpress.org/Conditional_Tags#A_Category_Page

    and you should bookmark the conditional logic page b/c i can almost guarantee you'll need it a lot. i do.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.