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 | |
// WP_Query arguments | |
$args = array( | |
'post_type' => 'post', | |
'post_status' => array( 'publish' ), | |
'posts_per_page' => -1, | |
'ignore_sticky_posts' => true, | |
'meta_query' => array( | |
'relation' => 'OR', |
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 | |
/** | |
* Load Single Page by Category | |
*/ | |
add_filter('single_template', function ($template) { | |
foreach ((array) get_the_category() as $cat) { | |
$templateFile = STYLESHEETPATH . "/single-category-{$cat->slug}.php"; | |
if (file_exists($templateFile)) { |
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 | |
add_action('pre_get_posts', function($query) { | |
if ($query->is_feed() && filter_input(INPUT_GET, 'count', FILTER_VALIDATE_INT) && filter_input(INPUT_GET, 'count', FILTER_VALIDATE_INT)) { | |
$query->set('posts_per_rss', filter_input(INPUT_GET, 'count', FILTER_VALIDATE_INT)); | |
} | |
return $query; | |
}); |
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
# ----------------------------------------------------------------- | |
# ver 1.1.0 | |
# | |
# Change Log: | |
# 20160721 - First version | |
# 20171018 - error_log added | |
# ----------------------------------------------------------------- | |
# ignore all files starting with . or ~ | |
.* |
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 | |
add_filter('acf/settings/save_json', function($path) { | |
return get_stylesheet_directory() . '/acf-json'; | |
}); | |
add_filter('acf/settings/load_json', function($paths) { | |
unset($paths[0]); | |
$paths[] = get_stylesheet_directory() . '/acf-json'; | |
return $paths; |
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 | |
add_action('acf/input/admin_footer', function() { | |
$themeJsonFile = get_stylesheet_directory() . '/theme.json'; | |
if(file_exists($themeJsonFile)) { | |
$themeJson = json_decode(file_get_contents($themeJsonFile)); | |
$colorsArray = []; | |
$colorsJson = ''; | |
foreach($themeJson->settings->color->palette as $color) { | |
$colorsArray[] = $color->color; |
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 | |
/** | |
* Enqueue scripts and styles. | |
*/ | |
function lrd_load_assets() { | |
wp_enqueue_style('fontawesome',"https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" ); | |
wp_enqueue_style( 'cd-extra-style', get_stylesheet_directory_uri()."/css/extra.css" ); |
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
if( is_testing() ) { | |
//test code here | |
} | |
else { | |
//original code here | |
} | |
/** | |
* Using query param | |
* http://example.com?testing=nav |
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
USER_NAME = "^[A-Za-z0-9_-]{min number of character,max number of character}$"; | |
TELEPHONE = "(^\\+)?[0-9()-]*"; | |
TELEPHONE_OPTIONAL = "^($|(^\\+)?[0-9()-]*)$" | |
EMAIL = "^([a-zA-Z0-9\.\_\+\-]+)@([a-zA-Z0-9\-]+)(\.[a-zA-Z]+)+$"; | |
EMAIL_OPTIONAL = "^($|[a-zA-Z0-9_\\.\\+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-\\.]+)$"; |
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
let videoProportionResize = (videoContainer) => { | |
const videos = document.querySelectorAll("iframe[src*='youtube.com'], iframe[src*='vimeo.com'], iframe[src*='twitch.tv']"); | |
if(videos.length === 0) { | |
console.log('no videos found'); | |
return false; | |
} | |
videoContainer = typeof videoContainer !== 'undefined' ? document.querySelector(videoContainer) : videos[0].parentNode; | |
const containerWidth = videoContainer.offsetWidth; |
NewerOlder