This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if( !function_exists( 'the_field' ) ) { | |
add_action( 'admin_notices', 'my_acf_notice' ); | |
} | |
function my_acf_notice() { | |
?> | |
<div class="update-nag notice"> | |
<p><?php _e( 'Please install Advanced Custom Fields, it is required for this plugin to work properly!', 'my_plugin_textdomain' ); ?></p> | |
</div> | |
<?php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if( !function_exists( 'the_field' ) && empty( get_option( 'my-acf-notice-dismissed' ) ) ) { | |
add_action( 'admin_notices', 'my_acf_admin_notice' ); | |
} | |
function my_acf_admin_notice() { | |
?> | |
<div class="notice error my-acf-notice is-dismissible" > | |
<p><?php _e( 'ACF is not necessary for this plugin, but it will make your experience better, install it now!', 'my-text-domain' ); ?></p> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_enqueue_scripts', 'my_plugin_assets' ); | |
function my_plugin_assets() { | |
wp_enqueue_script( 'my-notice-update', plugins_url( '/js/notice-update.js', __FILE__ ), array( 'jquery' ), '1.0', true ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).on( 'click', '.my-acf-notice .notice-dismiss', function() { | |
jQuery.ajax({ | |
url: ajaxurl, | |
data: { | |
action: 'my_dismiss_acf_notice' | |
} | |
}) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'admin_init', 'my_detect_acf' ); | |
function my_detect_acf() { | |
if( !function_exists( 'the_field' )) { | |
delete_option( 'my-acf-notice-dismissed' ); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' ); | |
function register_my_dashboard_widget() { | |
wp_add_dashboard_widget( | |
'my_dashboard_widget', | |
'My Dashboard Widget', | |
'my_dashboard_widget_display' | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function register_my_dashboard_widget() { | |
global $wp_meta_boxes; | |
wp_add_dashboard_widget( | |
'my_dashboard_widget', | |
'Publication Schedule', | |
'my_dashboard_widget_display' | |
); | |
$dashboard = $wp_meta_boxes['dashboard']['normal']['core']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="comment-stat-bars"> | |
<div class="comment-stat-bar"></div> | |
<div class="comment-stat-bar"></div> | |
<!-- etc... --> | |
</div> | |
<div class="comment-stat-labels"> | |
<div class="comment-stat-label">comment count here</div> | |
</div> | |
<div class='comment-stat-caption'>Comments in the past 5 weeks</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'admin_enqueue_scripts', 'dashboard_widget_display_enqueues' ); | |
function dashboard_widget_display_enqueues( $hook ) { | |
if( 'index.php' != $hook ) { | |
return; | |
} | |
wp_enqueue_style( 'dashboard-widget-styles', plugins_url( '', __FILE__ ) . '/widgets.css' ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.comment-stat-bars { | |
overflow:hidden | |
} | |
.comment-stat-bar { | |
margin:0 1%; | |
background-color: #2ea2cc; | |
border-top-color: #fff; | |
border-top-style: solid; | |
float:left; |