categories - wp_list_categories set order manually?

admin2025-01-07  6

Is it possible to do this? In the codex the 'orderby' option does not allow manual ordering (only ascending ID, name, count, slug etc).

Here is the code:

<?php
    wp_list_categories('include=16,17,15&title_li=<h3>' . __('By Content') . '</h3>' ); 
?>

This is currently alphabetical since I havent included the 'orderby' statement. I want them ordered 17,15,16 but only these 3 cats which are not alphabetical.

Is this possible?

Is it possible to do this? In the codex the 'orderby' option does not allow manual ordering (only ascending ID, name, count, slug etc).

Here is the code:

<?php
    wp_list_categories('include=16,17,15&title_li=<h3>' . __('By Content') . '</h3>' ); 
?>

This is currently alphabetical since I havent included the 'orderby' statement. I want them ordered 17,15,16 but only these 3 cats which are not alphabetical.

Is this possible?

Share Improve this question edited Jun 11, 2015 at 8:58 Pieter Goosen 55.4k23 gold badges115 silver badges209 bronze badges asked Jun 11, 2015 at 7:40 buksidabuksida 91 silver badge3 bronze badges 1
  • The Category Order and Taxonomy Terms Order plugin may solve the issue: – WP Updoot Commented Nov 17, 2019 at 8:16
Add a comment  | 

1 Answer 1

Reset to default 0

I would use get_categories() to first get an associative array of all the categories and then sort it how you want it.

$categories = get_categories('include=16,17,15');
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736261849a772.html

最新回复(0)