• Does anybody know if it’s possible to make default posts hierarchical without changing the publication dates? I have a client that filled in > 100 posts but now wants to change the order.

    Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • What do you mean by “hierarchical”? A drop-down menu with sub-menus is “hierarchical”. Do you perhaps mean alphabetical?

    If so, you need to modify your WP_Query() to something like this:

    <?php $query = new WP_Query( array ( 'orderby' => 'title', 'order' => 'ASC' ) ); ?>

    If you don’t have a WP_Query() in your code, then add it before the line that says <?php if ( have_posts() ) : ?>

    Hope that helps

    Peter

    PS: Here’s the reference in the Codex for WP_Query()

    Thread Starter kpoelhekke

    (@kpoelhekke)

    Thanks for the answer peter,

    With hierarchical i mean that posts can be sorted.. For eg custom fieds/taxonomies you can make them hierarchical:

    <?php
    register_taxonomy('genre',array('book'), array(
    'hierarchical' => true, // this makes it hierarchical in the UI
    'labels' => $labels,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array( 'hierarchical' => true ), // this makes hierarchical URLs
    ));

    I have a plugin that lets you drag and drop hierarchical post types in your preferred order.. I am wondering if this is possible for the default post type also.. ??

    Ah, now that I don’t know.

    There is a plugin (called Convert Post Types) that will convert posts into custom post types. At least that way you can convert all of your normal posts to custom ones and then have them hierarchical.

    If you go that route, don’t forget that you’ll need to do a custom WP_Query() each time as the standard query only does regular posts.

    Peter

    Thread Starter kpoelhekke

    (@kpoelhekke)

    Thanks peter! I guess i will use that plugin then ?? Great help..

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Make default post type hierarchical’ is closed to new replies.