Title: [Plugin: List Pages Shortcode] page order
Last modified: August 20, 2016

---

# [Plugin: List Pages Shortcode] page order

 *  Resolved [Zambrano Sergio](https://wordpress.org/support/users/sergiozambrano/)
 * (@sergiozambrano)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-list-pages-shortcode-page-order/)
 * Can you point me where to hack the code to add a class to each li with the page-
   order?
    (The manual page order defined in the post editor) Id like to style the
   list with different icons, and later exporting those pages to be used on another
   site, which will definitely make the page-ids different.
 * It could be replacing the id attribute if it’s easier to implement, but I prefer
   to use classes to prevent duplicate icons by omission or duplication of page-
   order values.
 * Thanks.
 * [http://wordpress.org/extend/plugins/list-pages-shortcode/](http://wordpress.org/extend/plugins/list-pages-shortcode/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Ben Huson](https://wordpress.org/support/users/husobj/)
 * (@husobj)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-list-pages-shortcode-page-order/#post-2304348)
 * The plugin uses the main WordPress wp_list_pages() function to output the list.
 * This function uses a filter which you can use to add classes:
    `apply_filters('
   page_css_class', $css_class, $page)`
 * Documentation for hooking into filters can be [found here](http://codex.wordpress.org/Plugin_API#Hook_in_your_Filter).
 * Would look something like this:
 *     ```
       function my_page_css_class( $css_class, $page ) {
          $css_class[] = 'my-new-class-' . $page->ID;
          return $css_class;
       }
       add_filter( 'page_css_class', 'my_page_css_class', 10, 2 );
       ```
   
 *  Thread Starter [Zambrano Sergio](https://wordpress.org/support/users/sergiozambrano/)
 * (@sergiozambrano)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-list-pages-shortcode-page-order/#post-2304503)
 * Ben,
 * Thanks, you are the man!
 * It sounds like that will add page_order classes to all pages retrieved by wp_list_pages(),
   but I think there’s no harm 🙂
 * Thanks a lot!
 *  Thread Starter [Zambrano Sergio](https://wordpress.org/support/users/sergiozambrano/)
 * (@sergiozambrano)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-list-pages-shortcode-page-order/#post-2304576)
 * I realized that by using page-slug I would make more sense for linking an icon
   with its page, rather than keeping track of which one is first or second (a pain
   if we reorder pages) but $post->post_name returns a number! not the slug.
 * If I make global $post inside the function, all of them return the same slug (
   slug of page id 7: The lowest id)
 *  [laptophobo](https://wordpress.org/support/users/laptophobo/)
 * (@laptophobo)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-list-pages-shortcode-page-order/#post-2304648)
 * Would this be the same as positioning the links in “menu order”. I’m using the
   plugin “My Page Order” and I need the list to follow that order (not ascending,
   descending or alpha).

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: List Pages Shortcode] page order’ is closed to new replies.

 * ![](https://ps.w.org/list-pages-shortcode/assets/icon-256x256.png?rev=1142967)
 * [List Pages Shortcode](https://wordpress.org/plugins/list-pages-shortcode/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/list-pages-shortcode/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/list-pages-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/list-pages-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/list-pages-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/list-pages-shortcode/reviews/)

## Tags

 * [attribute](https://wordpress.org/support/topic-tag/attribute/)
 * [class](https://wordpress.org/support/topic-tag/class/)
 * [display](https://wordpress.org/support/topic-tag/display/)
 * [id](https://wordpress.org/support/topic-tag/id/)
 * [show](https://wordpress.org/support/topic-tag/show/)
 * [sort](https://wordpress.org/support/topic-tag/sort/)
 * [value](https://wordpress.org/support/topic-tag/value/)

 * 4 replies
 * 3 participants
 * Last reply from: [laptophobo](https://wordpress.org/support/users/laptophobo/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-list-pages-shortcode-page-order/#post-2304648)
 * Status: resolved