Skip to content

Instantly share code, notes, and snippets.

View gnistdesign's full-sized avatar

Gnist Design gnistdesign

View GitHub Profile
@gnistdesign
gnistdesign / functions.php
Last active November 25, 2016 10:56
Custom tax query
<?php
add_rewrite_rule(
'^result/([^/]*)/?([^/]*)$',
'index.php?pagename=result&style_slug=$matches[1]&gender_slug=$matches[2]',
'top' );
add_rewrite_tag('%style_slug%','([^/]*)');
add_rewrite_tag('%gender_slug%','([^/]*)');
@gnistdesign
gnistdesign / gist:6635082
Last active December 23, 2015 12:28
Automatically include() every PHP-file within folder «/inc» in your Theme-folder.
// LAZY INCLUDES
$incdir = 'inc';
if(file_exists( TEMPLATEPATH.'/'.$incdir )){
$files = scandir( TEMPLATEPATH.'/'.$incdir );
if(is_array($files)){
foreach($files as $file):
if(stristr(basename($file), '.php'))
include($incdir.'/'.basename($file));
endforeach;
}