The Technology database of Duke Yin

WordPress 主题提醒用户安装一个插件

in functions.php:

 /* check required plugins */
add_action( 'admin_notices', 'dukeyin_theme_dependencies' );
function dukeyin_theme_dependencies() {
  if( ! function_exists('new_cmb2_box') )
    echo '<div class="notice notice-error"><p>' . __( '<h4>Warning: Plugin Missing: CMB2</h4>The DukeYin theme needs Plugin <a href="https://wordpress.org/plugins/cmb2/" target="_blank">CMB2</a> to function. Search "CMB2" in wordpress plugin panel, install and activit it.', 'dukeyin' ) . '</p></div>';
if(!function_exists('simpleYearlyArchive'))
   echo '<div class="notice notice-warning"><p>' . __( '<h4>Notice: Plugin Missing: Simple Yearly Archive</h4>The DukeYin theme needs Plugin <a href="https://wordpress.org/plugins/simple-yearly-archive/" target="_blank">Simple Yearly Archive</a> to display the archive page. Search "Simple Yearly Archive" in wordpress plugin panel, install and activit it to make your site better.', 'dukeyin' ) . '</p></div>';
}

 

‘new_cmb2_box’ is a function only in your required plugin, replace it with what you need.

# #

发布评论引用.

评论