投稿画面の公開ボタンを押した時に確認メッセージを表示する
投稿画面の公開ボタンを押した時に確認メッセージを表示したい場合、テーマのfunctions.phpに下記のように記載します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
function post_submit_dialog() { ?> <script> jQuery(function($){ var $button = $('#publish'); $button.click(function(){ if ( $button.val() == <?php echo json_encode( __( 'Publish' ) ) ?> ) { if ( ! window.confirm( '公開します。よろしいですか?' ) ) { return false; } } }); }); </script> <?php } add_action('admin_footer-post.php', 'post_submit_dialog' ); add_action('admin_footer-post-new.php', 'post_submit_dialog' ); |