Support » Plugin: Simple Page Ordering » How to make plugin work with custom post type

Viewing 14 replies - 1 through 14 (of 14 total)
  • You’ll need to add them when you register your custom post type using the register_post_type function.

    See the “Elaborate” example in the codex page that I linked above. If you’re using a plugin to create your custom post type, try to see if you can add an argument:

    'supports' => array('title, thumbnail', 'page-attributes' )

    Also remember to add the ‘orderby’ => ‘menu_order’ and ‘order’ => ‘ASC’, to the following in your custom query:

    $args = array(
        'numberposts' => -1,
        'orderby' => 'menu_order',
        'order' => 'ASC',
        'post_type' => 'staff'
    );
    $staff = get_posts($args);

    I’m using a premium theme that has already made custom post types as part of the theme.

    In which file do you use ‘register_post_type function?’ If you can help me understand this, I might be able to figure out where to put the additional code you provided me.

    Thanks!

    I can’t really answer this question without looking at the theme code. If you’re using a premium paid theme, I suggest that you ask the theme developers directly. They’ll probably have a support forum for this.

    If not, I would use a code editor to search the theme template files for the specific custom post type slug and or the term ‘register_post_type’.

    Ok. I found where to add the custom query.

    When you refer to ‘register_post_type function’ I suspect this would be in the theme’s function file?

    Assuming this is correct, what code exactly would need to be added here?

    You can refer to the codex page that I linked above. As I mentioned, the ‘elaborate’ example shows you where the argument goes.

    Ok. Found the right place to add the code.

    Got the hierarchical to true.

    But can you help me with:
    include page-attributes
    simple_page_ordering_is_sortable filter

    I don’t see these in the link you referenced.

    Figured out the ‘page-attributes.’

    Just the page ordering left.

    Thanks!

    Got everything to work (placed all the code where it needed to go).

    Still having one problem.

    When I got o adjust my order, the circle that spins to show it’s ‘working’ never stops spinning and the change is not saved in the DB. What’s causing this?

    The plugin won’t add in changes to your template markup. Did you add the modified query code in your template?

    'orderby' => 'menu_order',
        'order' => 'ASC',

    It won’t work without it.

    Yes.

    It just keeps spinning.

    If I refresh the page, I notice that it saved the entry. But this is counter-productive. I should be able to move many items around before refreshing the page, no?

    The spinning should stop with the ‘page-attributes’ fix. Thanks tnoguchi!

    You’re welcome. The FAQ on the plugin page isn’t very clear, but it seems that in addition to adding the argument to page-attributes in the register_post_type function, it seems necessary to also add 'order' => 'ASC' in the template custom query in addition to the ‘orderby' argument.

    Plugin Author Jake Goldman

    (@jakemgold)

    Actually, the plug-in is supposed to support EITHER post types with hierarchical support *or* page-attributes… bug there’s a small bug in 2.1 that breaks that.

    Fixed in 2.1.1. Thanks for helping bring this to my attention!

    Thanks!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘How to make plugin work with custom post type’ is closed to new replies.