• Resolved transom

    (@transom)


    There is a coding error in your function custom_post_type_onomies_change_header_label around line 145:

    Javascript doesn’t support default parameter values. The correct coding for this function is

    jQuery.fn.custom_post_type_onomies_change_header_label = function( $default_header_label ) {
    	if ( jQuery( this ).val() != '' )
    		jQuery( '#edit_custom_post_type_header .label' ).html( jQuery( this ).val() );
    	else if ( ! typeof($default_header_label) === 'undefined' )
    		jQuery( '#edit_custom_post_type_header .label' ).html( $default_header_label );
    }

    Very useful plugin

    http://wordpress.org/plugins/cpt-onomies/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thanks for pointing this out!

    Thread Starter transom

    (@transom)

    Sorry to say – found another error in admin-edit.js [same problem]

    Here is the part of the code I replaced:

    jQuery.fn.cpt_onomy_remove_from_quick_edit_checklist = function( $term_ids, $include ) {
    
    	if ( typeof $include === 'undefined' ) { $include = false; }
    
    	jQuery( this ).children( 'li' ).each( function() {
    
    		// retrieve item info
    		var $list_item = jQuery( this );
    		var $list_item_id = parseInt( $list_item.attr( 'id' ).match( /[0-9]+/ ) );
    
    		// remove item
    		// if $include is true, we're removing everything NOT in $term_ids
    		// otherwise, remove if in $term_ids
    		if ( ( $include && jQuery.inArray( $list_item_id, $term_ids ) == -1 )
    			|| ( ! $include && jQuery.inArray( $list_item_id, $term_ids ) > -1 ) )
    			$list_item.remove();
    
    	});
    }

    After your initial message, I went through and removed all my supposed default parameters for the next update. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Javascript coding error in admin-options.js’ is closed to new replies.