Forums

how to order categories as input (7 posts)

  1. wildbug
    Member
    Posted 2 months ago #

    In my theme settings, I get to specify which categories appear however they are displaying alphabetically rather than the order I input them. What can I do to this query to display categories as they are input? Thank you!

    query_posts('showposts=' . fs_settings('newsleft_category_length') . '&cat='.$category->cat_ID);

  2. richarduk
    Member
    Posted 2 months ago #

  3. wildbug
    Member
    Posted 2 months ago #

    Thank you so much, but can you show me how to put it in my query code...I cannot figure that out. THANKS!!

  4. MichaelH
    moderator
    Posted 2 months ago #

    query_posts('orderby=menu_order&order=ASC&showposts=' . fs_settings('newsleft_category_length') . '&cat='.$category->cat_ID);

    See query_posts() for other arguments

  5. wildbug
    Member
    Posted 2 months ago #

    Thank you so much. Only I realized that I was actually wanting the categories to be listed by menu rather than the posts. I tried applying that code to the category code but it didn't work. Do you have any ideas how to do that? I REALLY appreciate it.

    Here is the current code:

    <?php
    		$categories = get_categories('hide_empty=1&include=' . fs_settings('resourcesleft_categories'));
    		foreach ($categories as $category) :
    		query_posts('showposts=' . fs_settings('resourcesleft_category_length') . '&cat='.$category->cat_ID);
    		if (have_posts()) : $count = 0;
    		?>

    And here is what I tried that did not work:

    <?php
    		$categories = get_categories('hide_empty=1&orderby=menu_order&order=ASC&include=' . fs_settings('resourcesleft_categories'));
    		foreach ($categories as $category) :
    		query_posts('showposts=' . fs_settings('resourcesleft_category_length') . '&cat='.$category->cat_ID);
    		if (have_posts()) : $count = 0;
    		?>
  6. MichaelH
    moderator
    Posted 2 months ago #

    I believe get_categories doesn't allow a sort by menu_order.

  7. Shane G
    Member
    Posted 2 months ago #

Reply

You must log in to post.

About this Topic