Hi, everyone!
I want to create a plugin or function that checks the current theme’s author name. If it doesn’t match a string of text, it will display an error message on the admin panel saying that it needs to be changed.
Here is the code I have so far (not much at all, as I was originally writing this as a function in the theme’s folder, until I realized that folder would get over-written when the theme updated).
<?php
add_action( 'admin_notices', 'custom_error_notice' );
function custom_error_notice(){
global $current_screen;
if (!empty($_COOKIE["wptheme" . COOKIEHASH]))
$theme_name = $_COOKIE["wptheme" . COOKIEHASH];
else
$theme_name = get_current_theme();
$theme = get_theme("$theme_name");
if ( $current_screen->parent_base == 'themes' )
echo "<div class'error'><p>$theme['Author']</p></div>";
}
?>
Any help would be greatly appreciated!
Thanks,
Samuel