Skip to content

Instantly share code, notes, and snippets.

@timba64
Last active October 26, 2018 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timba64/5983a7f75141d6803d6cc3a1ed43ca34 to your computer and use it in GitHub Desktop.
Save timba64/5983a7f75141d6803d6cc3a1ed43ca34 to your computer and use it in GitHub Desktop.
some functions for Wordpress
//add styles only on one page of admin area Wordpress
add_action( 'admin_enqueue_scripts', 'add_css_help_page' );
function add_css_help_page( $hook ){
//wp_die($hook);
// output help.css only on help page in admin zone
if($hook != 'toplevel_page_help') {
return;
}
wp_enqueue_style( 'css-help-admin', get_template_directory_uri() .'/help.css' );
}
// Register widget in console page of Wordpress
add_action('wp_dashboard_setup', 'abm_dashboard_widgets' );
function abm_dashboard_widget_function( $post, $callback_args ) {
$url = admin_url('admin.php?page=help');
echo "<p>Если вам нужно вспомнить как редактировать содержание сайта, используйте ссылку на страницу помощи.</p>";
echo "<p><a href='" . $url ."'>Как редактировать содержимое сайта?</a></p>";
}
function abm_dashboard_widgets() {
wp_add_dashboard_widget('abm_widget', 'Страница описания', 'abm_dashboard_widget_function');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment