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_filter( 'pre_get_posts', function($query){ | |
if ( !is_search() ){ | |
return $query; | |
} | |
if ( ($post_type = $query->get('post_type')) ) { | |
$query->set('post_types', $post_type); | |
} |
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
functions.php | |
=============== | |
function get_the_permalink(){ | |
global $post; | |
return get_permalink( $post->ID ); | |
} |
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
color = { | |
black: '\x1b[30m' | |
red: '\x1b[31m' | |
green: '\x1b[32m' | |
yellow: '\x1b[33m' | |
blue: '\x1b[34m' | |
magenta: '\x1b[35m' | |
cyan: '\x1b[36m' | |
white: '\x1b[37m' | |
} |
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 | |
/** | |
* Check if a role is assigned to a particular user | |
* | |
* @param string $role | |
* @param int $user_id | |
* @return bool | |
*/ | |
function user_has_role( $role, $user_id = null ) { | |
if ( is_numeric( $user_id ) ) { |
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
http://codepen.io/rglazebrook/pen/87e0eef911eef54857fdd559f4f6c738 |
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 | |
$build_time = filemtime( get_stylesheet_directory() . '/style.css' ); | |
function set_enqueue_ver( $data ) use ( $build_time ) { | |
$data->default_version = $build_time; | |
} | |
add_action( 'wp_default_scripts', 'set_enqueue_ver' ); | |
add_action( 'wp_default_styles', 'set_enqueue_ver' ); |