Plugin Directory

Changeset 1597748


Ignore:
Timestamp:
02/17/2017 06:01:10 AM (9 years ago)
Author:
somatic
Message:

pushing 1.8.12 update (removal of nav menu editor hacks, works with WP4.4 again)

Location:
somatic-framework
Files:
128 added
2 edited

Legend:

Unmodified
Added
Removed
  • somatic-framework/trunk/inc/somaTypes.php

    r1317240 r1597748  
    1010        add_action( 'contextual_help', array( __CLASS__, 'custom_type_help_text' ), 10, 3 );
    1111        add_action( 'right_now_content_table_end' , array( __CLASS__, 'custom_types_rightnow' ) );
    12         add_action( 'admin_head-nav-menus.php', array( __CLASS__, 'filters_for_cpt_archives' ) );    // hacks the output of CPT nav menu items displayed in Appearance -> Menus
    13         add_filter( 'hidden_meta_boxes', array( __CLASS__, 'show_cpt_menus' ), 10, 2 );       // hacks the display of CPT in Appearance -> Menus (screen options hack)
    1412        add_filter( 'parse_query', array( __CLASS__, 'filter_current_query' ) );         // modifies ordering when querying CPTs
    1513        add_filter( 'posts_orderby', array( __CLASS__, 'posts_orderby' ) );          // modifies ordering when querying CPTs
     
    438436    }
    439437
    440     // generate filter hooks for adding cpt archive checkboxes
    441     // props to Kevin Langley https://github.com/klangley/cpt-archive-to-nav
    442     function filters_for_cpt_archives() {
    443         $post_type_args = array(
    444             'show_in_nav_menus' => true
    445         );
    446 
    447         $post_types = get_post_types( $post_type_args, 'object' );
    448 
    449         foreach ( $post_types as $post_type ) {
    450             if ( $post_type->has_archive ) {
    451                 add_filter( 'nav_menu_items_' . $post_type->name, array( __CLASS__, 'add_cpt_archive_checkbox' ), null, 3 );
    452             }
    453         }
    454     }
    455 
    456     // inject a new checkbox item in Apppearance -> Menus -> (your cpt) visible in the "view all" tab --- so you can manually add a custom nav menu item for your CPT archive pages
    457     // props to Kevin Langley https://github.com/klangley/cpt-archive-to-nav
    458     function add_cpt_archive_checkbox( $posts, $args, $post_type ) {
    459         global $_nav_menu_placeholder, $wp_rewrite;
    460         $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
    461 
    462         array_unshift( $posts, (object) array(
    463                 'ID' => 0,
    464                 'object_id' => $_nav_menu_placeholder,
    465                 'post_content' => '',
    466                 'post_excerpt' => '',
    467                 'post_title' => $post_type['args']->labels->name,
    468                 'post_name' => $post_type['args']->name,
    469                 'post_type' => 'nav_menu_item',
    470                 'type' => 'custom',
    471                 'url' => get_post_type_archive_link( $args['post_type'] )
    472             ) );
    473 
    474         return $posts;
    475     }
    476 
    477     // shows the metabox listing the custom post type or taxonomy in Appearance->Menus
    478     function show_cpt_menus( $boxes, $screen ) {
    479         $args = array( '_builtin' => false, 'show_in_nav_menus'=> true );
    480         $types = array_keys( get_post_types( $args ) );
    481         $taxes = array_keys( get_taxonomies( $args ) );
    482         $list = array_merge( $types, $taxes );
    483         foreach ( $list as $item ) {
    484             $killkey = array_search( "add-".$item, $boxes );
    485             if ( $killkey ) {
    486                 unset( $boxes[$killkey] );
    487             }
    488         }
    489         return $boxes;
    490     }
    491 
    492438    // kill the core Publish metabox
    493439    function remove_publish_box() {
  • somatic-framework/trunk/readme.txt

    r1317240 r1597748  
    55Requires at least: 4.0
    66Tested up to: 4.1
    7 Stable tag: 1.8.11
     7Stable tag: 1.8.12
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3535= 1.8.12 =
    3636* no longer using custom menu icons, but the built-in dashicons set, so the custom post type argument "icon_set" is deprecated. Simply provide the argument "menu_icon" in the post type declaration. Documentation https://developer.wordpress.org/resource/dashicons/
     37* removed hacks for injecting custom post type archives into the Nav Menu editor (not needed anymore, and was breaking editor)
    3738
    3839= 1.8.11 =
Note: See TracChangeset for help on using the changeset viewer.