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 dashboard_widget_display_enqueues( $hook ) { | |
if( 'index.php' != $hook ) { | |
return; | |
} | |
wp_enqueue_style( 'dashboard-widget-styles', plugins_url( '', __FILE__ ) . '/widgets.css' ); | |
} | |
add_action( 'admin_enqueue_scripts', 'dashboard_widget_display_enqueues' ); |
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
global $wpdb; | |
for( $i=1; $i <= 5; $i++ ) { | |
$this_week = 7 * $i; | |
$last_week = 7 * ( $i - 1); | |
$comment_counts[] = | |
$wpdb->get_var( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_date > '" . date('Y-m-d H:i:s', strtotime('-' . $this_week . ' days')) . "' AND comment_date < '" . date('Y-m-d H:i:s', strtotime('-' . $last_week . ' days')) . "'" ) ; |
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
/* Regular jQuery */ | |
$('.hideable').on('click', function() { | |
$(this).hide(); | |
}) | |
/* Compatibility Mode */ | |
jQuery('.hideable').on('click', function() { | |
jQuery(this).hide(); | |
}) |
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).ready(function( $ ) { | |
$('.hideable').on('click', function() { | |
$(this).hide(); | |
}) | |
}); |
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 my_theme_scripts() { | |
wp_enqueue_script( 'my-great-script', get_template_directory_uri() . '/js/my-great-script.js', array( 'jquery' ), '1.0.0', true ); | |
} | |
add_action( 'wp_enqueue_scripts', 'my_theme_scripts' ); |
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 my_admin_scripts() { | |
wp_enqueue_script( 'my-great-script', plugin_dir_url( __FILE__ ) . '/js/my-great-script.js', array( 'jquery' ), '1.0.0', true ); | |
} | |
add_action( 'admin_enqueue_scripts', 'my_admin_scripts' ); |
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
// include custom jQuery | |
function shapeSpace_include_custom_jquery() { | |
wp_deregister_script('jquery'); | |
wp_enqueue_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js', array(), null, true); | |
} | |
add_action('wp_enqueue_scripts', 'shapeSpace_include_custom_jquery'); |
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_loaded', 'register_all_scripts' ); | |
function register_all_scripts() | |
{ | |
wp_register_script(...); | |
} |
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', 'enqueue_front_scripts' ); | |
add_action( 'admin_enqueue_scripts', 'enqueue_back_scripts' ); |