15-minute interval aggregation PHP $midpoint = floor(($minutes+7)/15)*15; JavaScript midpoint = Math.floor((minutes+7)/15)*15;
Screen cheatsheet Detaching control + A and then immediately followed by D Resuming a screen screen -r
Default WordPress .htaccess Hostname installation # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f
Getting the timezone offsets The difference between the generated time using: the Default timezone setting; versus the UTC timezone JavaScript new Date().getTimezoneOffset(); WordPress
Creating and managing nonce on Wordpress Creating a raw nonce value Action-based $nonce = wp_create_nonce( 'my-action_'.$post->ID ); // 295a686963 HTML sample
Adding screen options on Wordpress functions.php function register_submenu_screen() { global $pagenow; if( $pagenow == 'options-general.php' && isset($_GET['page']) && $_GET['page']=='integrations' ) { $screen = get_current_screen(); add_filter( 'screen_layout_columns', 'embed_submenu_screen' );
Calculating the Easter date with PHP get_easter_datetime() function get_easter_datetime($year) { $base = new DateTime("$year-03-21"); $days = easter_days($year); return $base->add(new DateInterval("P{$days}D")); }
Wordpress AJAX Cheatsheet Table of contents Adding ajaxurl for the public side (optional) Preparing callable functions Hook for the admin side Hook for the public side (optional) jQuery implementation Asynchronous POST
Wordpress cheatsheet User management Getting the current user echo get_current_user_id(); //1 Getting the data of a user