PHP
29
Wordpress backend post/page hooks (get_current_screen) By micha on 2nd December 2020 03:16:56 PM
- <?php
- add_action( 'all_admin_notices', function() {
- $screen = get_current_screen();
- //var_dump($screen);
- if( 'edit-quiz' === $screen->id ) {
- echo '<p>Greetings from <strong>edit -> overview</strong>!</p>';
- }
- if( 'quiz' === $screen->id ) {
- echo '<p>Greetings from <strong>post -> edit / new</strong>!</p>';
- //before content
- add_action( 'edit_form_after_title', 'add_content_before_editor' );
- function add_content_before_editor() {
- echo '<b>After title</b>: Yay we have found the pos';
- }
- //before title
- add_action( 'edit_form_top', 'add_content_before_title' );
- function add_content_before_title() {
- echo '<font color="red">Or may b... </font><b>Yaaaaaaay </b>we have a better pos found';
- }
- }
- });
Recent Pastes