The dialog HTML comes from WP_Editors::wp_link_dialog()
but no hooks in there.
We could instead use jQuery to append the custom HTML to the link dialog and try to override e.g. the wpLink.getAttrs()
, because it’s very short .
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | jQuery( document ).ready( function( $ ) { $('#link-options').append( '<div> <label><span>Link Class</span> <select name="wpse-link-class" id="wpse_link_class"> <option value="normal">normal</option> <option value="lightbox">lightbox</option> </select> </label> </div>' ); wpLink.getAttrs = function() { wpLink.correctURL(); return { class: $( '#wpse_link_class' ).val(), href: $.trim( $( '#wp-link-url' ).val() ), target: $( '#wp-link-target' ).prop( 'checked' ) ? '_blank' : '' }; } }); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.