Add this code to functions.php:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<?php // Add to the new post screen for any post type add_action( 'admin_footer-post-new.php', 'wpse_add_required_attr_to_title_field' ); // Add to the post edit screen for any post type add_action( 'admin_footer-post.php', 'wpse_add_required_attr_to_title_field' ); function wpse_add_required_attr_to_title_field() { ?> <script> jQuery(document).ready(function($){ $('input[name=post_title]').addClass('check'); $('input[name=post_title]').each(function() { var textbox = $(document.createElement('textarea')).val(this.value); console.log(this.attributes); $.each(this.attributes, function() { if (this.specified) { textbox.prop(this.name, this.value) } }); $(this).replaceWith(textbox); }); $('.check').css('min-height', '300px'); }); </script> <?php } ?> |