Simple Page Ordering
Custom post types and query orderby (1 post)

  1. guiniveretoo
    Posted 2 years ago #

    Hey there! Great plugin and I do love it a lot.

    I'm having trouble with a custom post type setup. The code for the custom post type is below:

    /* Employees */
    	$labels = array(
    		'name'               => __( 'Employees' ),
    		'singular_name'      => __( 'Employee' ),
    		'add_new'            => __( 'Add New Employee' ),
    		'add_new_item'       => __( 'Add New Employee' ),
    		'view'               => __( 'View Employee' ),
    		'view_item'          => __( 'View Employee' ),
    		'search_items'       => __( 'Search Employees' ),
    		'not_found'          => __( 'No employees found' ),
    		'not_found_in_trash' => __( 'No employees in Trash' ),
    	$args = array(
    		'labels'            => $labels,
    		'public'            => true,
    		'show_in_nav_menus' => false,
    		'has_archive'       => true,
    		'heirarchical'      => true,
    		'supports'          => array( 'title','editor','thumbnail','page-attributes')

    This is wrapped in a function that is add_action()'ed to "init."

    There are two issues that are only associated with the custom post type main list editing page. The first error is minor but might help in diagnosing the others: a couple of notices that show up when I have errors turned on.

    I get this notice at the top of the page:

    Notice: Undefined index: orderby in /localhost/wp-content/plugins/simple-page-ordering/simple-page-ordering.php on line 57

    And I get this one just above the sorting options:

    Notice: Undefined index: orderby in /localhost/wp-content/plugins/simple-page-ordering/simple-page-ordering.php on line 159

    After that, the sorting function itself isn't automatically turned on. I can click on "Sort by Order" and the errors disappear, the pages are draggable, and it saves my changes - but it only lasts until I navigate away from the page. I have to click that button every time I load that screen if I want it to work. It's a minor annoyance, but I don't want to have to teach my client something that should Just Work.

    Any suggestions, fixes, help?


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic