Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • The problem was that clicking “update” in the quick-edit view triggers a re-creation of the row for page/post. Thus the handler gets killed. But if we use a delegated handler it works again

    /**
     * Scripts executed on post overview page.
     */
    if(jQuery(".edit-php").length > 0) {
    	jQuery('#the-list').on('click', 'a.editinline',	function() {
    			var postId = jQuery(this).parents("tr").attr("id").replace("post-", "");
    			// var secondaryTitle = jQuery(".my-secondary-title-quick-edit-label").clone();
    			setTimeout(
    				function() {
    					// jQuery("#edit-" + postId).find(".inline-edit-col label:first").after(secondaryTitle).show();
    							jQuery("#edit-" + postId).find(".my-secondary-title-quick-edit-label input").val(
    								jQuery('#post-' + postId).find('.secondary_title').text()
    					);
    				}, 50
    			);
    		}
    	);
    }

    Hey,
    sorry, I’ve been quite busy. Hm, yes, I experience the same error under Firefox. I’ll have a look.

    Hi,
    had the same problem. I fixed it for me locally and would really appreciate if you included it into your code.

    hooks.php (add it)

    /**
    	 * Add a custom input field to the quick edit menu
    	 */
    	function secondary_title_quick_edit_custom_box($column_name, $post_type){
    
    		// return early for all columns not owned by us
    		if( $column_name !== 'secondary_title')
    			return;
    
    		// quite the same like secondary_title_overview_quick_edit() but class name differs
    		echo '<label class="my-secondary-title-quick-edit-label">';
    		echo '<span class="title">' . __("Sec. title", "secondary_title") . '</span>';
    		// no value here (will be inserted on click on a.editinline)
    		echo '<span class="input-text-wrap"><input type="text" name="secondary_title" value="" /></span>';
    		echo "</label>";
    
    	}
    
    	add_action('quick_edit_custom_box',  'secondary_title_quick_edit_custom_box', 10, 2);

    admin.js (modify)

    /**
    		 * Add the "Sec. title" input field to the quick edit.
    		 */
    		jQuery('tr#inline-edit td .inline-edit-col-left > .inline-edit-col > label').eq(0).after(jQuery('.my-secondary-title-quick-edit-label'));
    
    		/**
    		 * Scripts executed on post overview page.
    		 */
    		if(jQuery(".edit-php").length > 0) {
    			jQuery("a.editinline").click(
    				function() {
    					var postId = jQuery(this).parents("tr").attr("id").replace("post-", "");
    					// var secondaryTitle = jQuery(".my-secondary-title-quick-edit-label").clone();
    					setTimeout(
    						function() {
    							// jQuery("#edit-" + postId).find(".inline-edit-col label:first").after(secondaryTitle).show();
    							jQuery("#edit-" + postId).find(".my-secondary-title-quick-edit-label input").val(
    								jQuery('#post-' + postId).find('.secondary_title').text()
    							);
    						}, 50
    					);
    				}
    			);
    		}

Viewing 3 replies - 1 through 3 (of 3 total)