• I have set up several custom post types for a portfolio site. Everything is working well but I’m having some issues with creating sidebar nav for each custom post type’s section. For instance, on this page for Custom Post Type “Prints & Note Cards” there are 3 categories with several pieces in each. Everything is being displayed but I’m having difficulty with the following:

    1. If you view the source code, WP is generating dozens and dozens of blank list items in the sidebar instead of list items for just the relevant pieces. This junk code needs to be prevented.

    2. I can’t figure out how to order the Categories, as in I’d like “Scenic Prints” to come first followed by “Floral Prints” and then “Note Cards”. Being able to set the order by ID, for instance, would be helpful.

    3. I’d like to be able to control the order of the pieces in each category, either alphabetically or by date, etc.

    Here is the code I’ve been using in the sidebar. I’m new to WP and PHP and this has been put together after a lot of tweaking and searching for code to get what I have so far.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Can anyone tell me if there’s a way to accomplish what I need to do, or even perhaps an easier way? The site has similar sections for Paintings, Design and Illustrations, some don’t have categories and list all pieces instead.

    Many thanks in advance.

  • The topic ‘Listing posts from Custom Post Types, controlling their display’ is closed to new replies.