Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Adding Custom Admin Notices in the Classic Editor wordpress

/**
 * Hook into the 'admin_notices' action to render
 * a generic HTML notice.
 */
function mysofthunt_admin_notice() {
    $screen = get_current_screen();
    // Only render this notice in the post editor.
    if ( ! $screen || 'post' !== $screen->base ) {
        return;
    }
    // Render the notice's HTML.
    // Each notice should be wrapped in a <div>
    // with a 'notice' class.
    echo '<div class="notice notice-success is-dismissible"><p>';
    echo sprintf( __( 'Post draft updated. <a href="%s" target="_blank">Preview post</a>' ), get_preview_post_link() );
    echo '</p></div>';
};
add_action( 'admin_notices', 'mysofthunt_admin_notice' );
Comment

PREVIOUS NEXT
Code Example
Javascript :: const and let keywords in ES6 
Javascript :: Template literals in ES6 Syntax Concatenation 
Javascript :: Classes and constructor functions in ES6 
Javascript :: blur area behind an element in react native 
Javascript :: copy file using java script 
Javascript :: selected item from dropdownlist 
Javascript :: reduce() method executes a reducer function on each element of the array and returns a single output value. 
Javascript :: convert java object to json 
Javascript :: find a node that match a spesific selector string in the paren 
Javascript :: send offer webrtc 
Javascript :: react native red Oval bubble 
Javascript :: regex generator 
Javascript :: keep form values after submit javascript 
Javascript :: loop through async javascript -IMP 
Javascript :: How to get only property names/keys from a nested object 
Javascript :: how i change background of row in javascript jquery 
Javascript :: create filepulse connector with json 
Javascript :: how to add carsoul to react project 
Javascript :: React Readonly rating 
Javascript :: slide div on click angular 
Javascript :: how to create event listener in javascript 
Javascript :: lieke==1 
Javascript :: update button response 
Javascript :: Install Date-Time in express.js 
Javascript :: var quotes 
Javascript :: convert string or string array to object mongoose object id 
Javascript :: sending string from jquery ajax to asp.net mvc controller. 
Javascript :: node.js vds connection was aborted 
Javascript :: javascript reduce array of objects group by property 
Javascript :: override submit button javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =