Forums

New category not sorting with others by order (7 posts)

  1. AMEEKER
    Member
    Posted 2 years ago #

    Here is the site I'm working with: http://heretoprotect.com/

    // Retrieve a list of selected categories
    	$categories = get_categories("orderby=order&hide_empty=1&hierarchial=0&include=$front_cat_list");

    and then here are is the front_cat_list:

    $front_cat_list = "24,4,20,11,25,16";

    No matter where in the list I add a category (37 was the particular one I wanted to add), it added it in the upper left position of the two columns of categories, rather than where I placed it. That category had one post attributed to it, and that post was not attributed to any other.

    I'm puzzled because I chose the order of the categories in the list in the first place - so I don't get why I can't just add one where I want.

    Thoughts?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    orderby=order? There's no such value. Valid values are id, name, slug, count and group.

    There's also a problem at the end of that line: &include=$front_cat_list"). Should be &include=" .$front_cat_list)

  3. AMEEKER
    Member
    Posted 2 years ago #

    Thanks esmi - you're always very helpful.

    I changed those things around and it allowed me to add the additional category.

    IS there a way to choose the order of the categories simply by the order they're listed, rather than id, name, slug, count or group?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    simply by the order they're listed

    Not sure what you mean by "order they're listed". That sounds rather like the order they're created (ie by id) to me.

    The list I gave is all that's available using orderby although you may be able to get different listings using a combination of the available parameters and values.

    http://codex.wordpress.org/Function_Reference/get_categories

  5. AMEEKER
    Member
    Posted 2 years ago #

    Sorry - I'll be more descriptive.

    I manually entered the ID's of the categories in the front_cat_list in the order they're listed above. By doing that, the categories displayed in that exact order. Now that I have changed it to "id", they're obviously not in that order anymore, but rather in numerical order, low to high, starting in the upper right on the page, then going back and forth right to left down the page.

    I wondered if there was a way to keep the order of how they're displayed on the page the same as they were originally.

    Thanks again!

  6. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    orderby=name might work better. At least that's how categories are normally listed in a sidebar etc.

  7. AMEEKER
    Member
    Posted 2 years ago #

    Ok - Thanks again esmi!

Topic Closed

This topic has been closed to new replies.

About this Topic