Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress notice

// for success
<div class="notice notice-success is-dismissible">
        <p><?php _e( 'Done!', 'sample-text-domain' ); ?></p>
</div>
  
// for error  
<div class="notice notice-error is-dismissible ">
        <p><?php _e( 'Error message here!', 'sample-text-domain' ); ?></p>
</div>
  
Comment

wordpress show notice

function sample_admin_notice__success() {
    ?>
    <div class="notice notice-success is-dismissible">
        <p><?php _e( 'Done!', 'sample-text-domain' ); ?></p>
    </div>
    <?php
}
add_action( 'admin_notices', 'sample_admin_notice__success' );
Comment

wordpress notice

# More advance version

function sample_admin_notice__error() {
    $class = 'notice notice-error';
    $message = __( 'Irks! An error has occurred.', 'sample-text-domain' );
 
    printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) ); 
}
add_action( 'admin_notices', 'sample_admin_notice__error' );
Comment

PREVIOUS NEXT
Code Example
Php :: getting last day of next month in php 
Php :: eloquent get distinct 
Php :: php delete element from array 
Php :: php change string to url friendly 
Php :: How do I make a redirect in PHP? 
Php :: random number laravel faker 
Php :: php create url with query sting from array 
Php :: convert float to integer laravel 
Php :: laravel limit relationship result 
Php :: deactivate plugin wp cli 
Php :: php month single digit 
Php :: get the content from post id wordpress 
Php :: php curl async callback 
Php :: php get class name without namespace from string 
Php :: Download multiple files as zip in PHP 
Php :: how to add property to an object in php 
Php :: separate date from datetime php 
Php :: how to know the path of php in linux 
Php :: turnery expression php 
Php :: if condition inside echo in php 
Php :: eloquent delete all where 
Php :: php basename from path 
Php :: delete all cookies in php 
Php :: install php 8 ubuntu 
Php :: get current month records in laravel 
Php :: php rsa encryption 
Php :: laravel foreign key constraint 
Php :: redirection in php 
Php :: header refresh page php 
Php :: display time php 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =