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
<?php | |
function list_thumbnail_sizes($type = 'all', $name = '') { | |
global $_wp_additional_image_sizes; | |
$sizes = array(); | |
$rSizes = array(); | |
foreach (get_intermediate_image_sizes() as $s) { | |
$sizes[$s] = array(0, 0); | |
if (in_array($s, array('thumbnail', 'medium', 'large'))) { | |
$sizes[$s][0] = get_option($s . '_size_w'); | |
$sizes[$s][1] = get_option($s . '_size_h'); |
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
<?php | |
/** | |
* Plugin Name: Convert ACF PHP to JSON | |
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON. | |
*/ | |
namespace ConvertAcfPhpToJson; | |
/** | |
* Add submenu item under 'Custom Fields' |
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
<?php | |
# Register custom post types on the 'init' hook. | |
add_action( 'init', 'my_register_post_types' ); | |
/** | |
* Registers post types needed by the plugin. | |
* | |
* @since 1.0.0 | |
* @access public |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Site Maintenance</title> | |
<style> | |
body { text-align: center; padding: 150px; } | |
h1 { font-size: 50px; } | |
body { font: 20px Helvetica, sans-serif; color: #333; } | |
article { display: block; text-align: left; width: 650px; margin: 0 auto; } |
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 isValidDate(value, userFormat) { | |
// Set default format if format is not provided | |
userFormat = userFormat || 'mm/dd/yyyy'; | |
// Find custom delimiter by excluding the | |
// month, day and year characters | |
var delimiter = /[^mdy]/.exec(userFormat)[0]; | |
// Create an array with month, day and year |
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
export const DAYS_IN_MONTH = [null, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] | |
function daysInMonth(year, month) { | |
// isValidDate checked that year and month are integers already. | |
// February of leap years. Assumes that the Gregorian calendar extends | |
// infinitely in the future and in the past. | |
if (month === 2 && (year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0))) { | |
return 29 | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |