This file contains 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 to your theme's functions.php file. De-queues Select2 styles & scripts. Useful to keep Boostrap form control formatting | |
/** | |
* Remove Woocommerce Select2 - Pre WC 3.2.1-ish | |
*/ | |
function woo_dequeue_select2() { | |
if ( class_exists( 'woocommerce' ) ) { | |
wp_dequeue_style( 'select2' ); | |
wp_deregister_style( 'select2' ); |
This file contains 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
// Contained within /inc/config.php. Modify default settings | |
// Dequeue default v1 jQuery, requeue jquery-migrate, add external cdn reference to jQuery v2. Load in header (true) | |
// Set up scripts - filterable array. See definitions for structure | |
$ipress_scripts = [ | |
// Core scripts: [ 'script-name', 'script-name2' ... ] | |
'undo' => [ 'jquery' ], | |
// Core scripts: [ 'script-name', 'script-name2' ... ] |
This file contains 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
/** | |
* Array to CSV | |
*/ | |
function array2csv( $array) { | |
// Check input | |
if ( !is_array( $array ) || count( $array ) == 0 ) { return null; } | |
// Buffer output | |
ob_start(); |
This file contains 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 | |
/** | |
* Retrieve remote image dimensions | |
* - getimagesize alternative | |
*/ | |
/** | |
* Get Image Size | |
* |
This file contains 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 | |
/** | |
* Convert jSON object to XML | |
*/ | |
// jSON object | |
$json = '{"China":["Guangzhou","Fuzhou","Beijing","Baotou","Hohhot","Guiyang","Yinchuan","Nanjing","Changzhou","Chuzhou","Hefei","Jinan","Qingdao","Harbin","Zhaodong","Taiyuan","Xian","Xianyang","Shenzhen","Nanning","Zhengzhou","Xinxiang","Luohe","Luoyang","Chaoyang","Xingyi","Foshan","Haikou","Chengdu","Dongguan","Mingzhou","Chongqing","Zhuhai","Kunming","Wuhan","Xiling","Huizhou","Jiangmen","Shantou","Changxiacun","Zhongshan","Lhasa","Nanchang","Tianjin","Shanghai","Hebei","Shijiazhuang","Quanzhou","Putian","Xiamen","Chengyang","Zhangzhou","Sanming","Nanping","Baoding","Langfang","Yantai","Binzhou","Lanzhou","Yueqing","Zhongxin","Zhoushan","Hangzhou","Ningbo","Wenzhou","Changchun","Fuyang","Jieshou","Anqing","Wuhu","Shishi","Shishi","Weitang","Shenyang","Changsha","Yongjiawan","Lengshuijiang","Shijiazhuang","Xuchang","Suzhou","Xuzhou","Taizhou","Nanyang","Xinhua","Ürümqi","Yanan Beilu","Baotao","Macao","Wuxi","Yangzhou","Baiyin","Tongren","Kunshan |
This file contains 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 | |
// Set future post status | |
$args = array( | |
'post_type' => 'post', | |
'post_status' => 'future' | |
); | |
// Process Query | |
$scheduled = new WP_Query( $args ); |
This file contains 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 if ( have_posts() ) : ?> | |
<?php while( have_posts() ) : the_post() ?> | |
<!-- Post Content Here --> | |
<?php endwhile ?> | |
<?php else : ?> | |
<!-- Content If No Posts --> | |
<?php endif ?> |
This file contains 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( 'pre_get_terms', 'filter_pre_get_terms', 10, 2 ); | |
/** | |
* Filter WP_Term_Query meta query | |
* - a better drill down for filtering term meta data | |
* - keeps pagination in line with term count | |
* - used in term edit page | |
* | |
* @param object $query WP_Term_Query | |
*/ |
NewerOlder