', $dismiss_button, $message );
}
add_action( 'admin_notices', 'amadeus_neve_notice' );
/**
* Update the amadeus_ignore_neve_notice_new option to true, to dismiss the notice from the dashboard
*/
function amadeus_nag_ignore_neve() {
global $current_user;
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add that to their user meta */
if ( isset( $_GET['amadeus_nag_ignore_neve'] ) && '0' == $_GET['amadeus_nag_ignore_neve'] ) {
add_user_meta( $user_id, 'amadeus_ignore_neve_notice_new', 'true', true );
}
}
add_action( 'admin_init', 'amadeus_nag_ignore_neve' );
/**
* Function that decide if current date is before a certain date.
*
* @param string $date Date to compare.
* @return bool
*/
function amadeus_is_before_date( $date ) {
$countdown_time = strtotime( $date );
$current_time = time();
return $current_time <= $countdown_time;
}
/**
* Retirement notice
*/
function amadeus_retirement_notice() {
global $current_user;
$user_id = $current_user->ID;
$ignored_notice = get_user_meta( $user_id, 'amadeus_ignore_retirement_notice' );
if ( ! empty( $ignored_notice ) ) {
return;
}
$should_display_notice = ! amadeus_is_before_date( '2019-09-12' );
if ( ! $should_display_notice ) {
return;
}
$dismiss_button =
sprintf(
/* translators: Install Neve link */
'',
'?amadeus_nag_ignore_retirement=0'
);
$theme_args = wp_get_theme();
$name = $theme_args->__get( 'Name' );
$notice_template = '
',
esc_html__( 'Your theme is no longer maintained. A New, Modern WordPress Theme is Here!', 'amadeus' ),
sprintf(
/* translators: %s - theme name */
esc_html__( '%s is no longer maintained. Switch to Neve today and get more powerful features (for free).', 'amadeus' ),
$name
)
);
$notice_picture = sprintf(
'',
esc_url( get_template_directory_uri() . '/images/neve.png' )
);
$notice_right_side_content = sprintf(
'
%1$s
%2$s
',
__( 'Switch to Neve today', 'amadeus' ),
// translators: %s - theme name
esc_html__( 'With Neve you get a super fast, multi-purpose theme, fully AMP optimized and responsive, that works perfectly with Gutenberg and the most popular page builders like Elementor, Beaver Builder, and many more.', 'amadeus' )
);
$notice_left_side_content = sprintf(
'
',
// translators: %s - theme name
sprintf( esc_html__( '%s is no longer maintained', 'amadeus' ), $name ),
// translators: %s - theme name
sprintf( __( 'We\'re saying goodbye to amadeus in favor of our more powerful Neve free WordPress theme. This means that there will not be any new features added although we will continue to update the theme for major security issues.', 'amadeus' ) ),
esc_url( admin_url( 'theme-install.php?theme=neve' ) ),
esc_html__( 'See Neve theme', 'amadeus' )
);
$style = '
.nv-notice-wrapper p{
font-size: 14px;
}
.nv-buttons-wrapper {
padding-top: 20px !important;
}
.nv-notice-wrapper h2{
margin: 0;
font-size: 21px;
font-weight: 400;
line-height: 1.2;
}
.nv-notice-wrapper p.about-description{
color: #72777c;
font-size: 16px;
margin: 0;
padding:0px;
}
.nv-notice-wrapper{
padding: 23px 10px 0;
max-width: 1500px;
}
.nv-notice-wrapper hr {
margin: 20px -23px 0;
border-top: 1px solid #f3f4f5;
border-bottom: none;
}
.nv-notice-column-container h3{
margin: 17px 0 0;
font-size: 16px;
line-height: 1.4;
}
.nv-notice-text p.ti-return-dashboard {
margin-top: 30px;
}
.nv-notice-column-container .nv-notice-column{
padding-right: 60px;
}
.nv-notice-column-container img{
margin-top: 23px;
width: 100%;
border: 1px solid #f3f4f5;
}
.nv-notice-column-container {
display: -ms-grid;
display: grid;
-ms-grid-columns: 24% 32% 32%;
grid-template-columns: 24% 32% 32%;
margin-bottom: 13px;
}
.nv-notice-column-container a.button.button-hero.button-secondary,
.nv-notice-column-container a.button.button-hero.button-primary{
margin:0px;
}
@media screen and (max-width: 1280px) {
.nv-notice-wrapper .nv-notice-column-container {
-ms-grid-columns: 50% 50%;
grid-template-columns: 50% 50%;
}
.nv-notice-column-container a.button.button-hero.button-secondary,
.nv-notice-column-container a.button.button-hero.button-primary{
padding:6px 18px;
}
.nv-notice-wrapper .nv-notice-image {
display: none;
}
}
@media screen and (max-width: 870px) {
.nv-notice-wrapper .nv-notice-column-container {
-ms-grid-columns: 100%;
grid-template-columns: 100%;
}
.nv-notice-column-container a.button.button-hero.button-primary{
padding:12px 36px;
}
}
';
$message = sprintf(
$notice_template,
$notice_header,
$notice_picture,
$notice_left_side_content,
$notice_right_side_content,
$style
);// WPCS: XSS OK.
printf( '
%1$s
%2$s
', $dismiss_button, $message );
}
add_action( 'admin_notices', 'amadeus_retirement_notice' );
/**
* Update the amadeus_ignore_retirement_notice option to true, to dismiss the notice from the dashboard
*/
function amadeus_nag_ignore_retirement() {
global $current_user;
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add that to their user meta */
if ( isset( $_GET['amadeus_nag_ignore_retirement'] ) && '0' == $_GET['amadeus_nag_ignore_retirement'] ) {
add_user_meta( $user_id, 'amadeus_ignore_retirement_notice', 'true', true );
}
}
add_action( 'admin_init', 'amadeus_nag_ignore_retirement' );