Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




_wp_nav_menu_meta_box_object [ WordPress Function ]

_wp_nav_menu_meta_box_object ( $object = null )
Access:
  • private
Parameters:
  • (object) $object The post type or taxonomy meta-object.
Returns:
  • (object) The post type of taxonomy object.
Defined at:



Adds custom arguments to some of the meta box object types.

Source


<?php
function _wp_nav_menu_meta_box_object$object null ) {
    if ( isset( 
$object->name ) ) {

        if ( 
'page' == $object->name ) {
            
$object->_default_query = array(
                
'orderby' => 'menu_order title',
                
'post_status' => 'publish',
            );

        
// posts should show only published items
        
} elseif ( 'post' == $object->name ) {
            
$object->_default_query = array(
                
'post_status' => 'publish',
            );

        
// cats should be in reverse chronological order
        
} elseif ( 'category' == $object->name ) {
            
$object->_default_query = array(
                
'orderby' => 'id',
                
'order' => 'DESC',
            );

        
// custom post types should show only published items
        
} else {
            
$object->_default_query = array(
                
'post_status' => 'publish',
            );
        }
    }

    return 
$object;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics