将此代码放入函数中。php主题(或子主题)文件。它使用jQuery在类别上方添加一个新框div
(<div id="categorydiv" class="postbox " >
).
add_action( \'admin_footer-post.php\', \'wpse_99252_add_categories_title_attribute\' );
add_action( \'admin_footer-post-new.php\', \'wpse_99252_add_categories_title_attribute\' );
/**
* Add a title attribute to categories box in the Post Editor.
*/
function wpse_99252_add_categories_title_attribute() { ?>
<script type="text/javascript">
// Setup tool tip box.
jQuery( "#categorydiv" ).before( \'<center id="categorydiv-tooltip">Which catgeory should I post in?</center>\' );
// Style it. Hide it.
jQuery( "#categorydiv-tooltip" ).css( {
\'margin-bottom\': \'4px\',
visibility: \'hidden\'
// Add more styles here.
} );
// Display or hide tool tip box on mouse events.
jQuery( "#categorydiv" ).mouseenter( function() {
jQuery( "#categorydiv-tooltip" ).css( \'visibility\', \'visible\' );
} ).mouseleave( function() {
jQuery( "#categorydiv-tooltip" ).css( \'visibility\', \'hidden\' );
} );
</script>
<?php
}