Skip to content

Instantly share code, notes, and snippets.

View derekshirk's full-sized avatar
🚙
Principal Product Designer at Driveway

Derek Shirk derekshirk

🚙
Principal Product Designer at Driveway
View GitHub Profile
@derekshirk
derekshirk / wordpress-query-basic.php
Last active August 29, 2015 14:16
WordPress-custom-query-loop-basic
<?php
$query = new WP_Query();
$query->query(array(
'post_type' => 'service',
'posts_per_page' => -1
));
$post_count = $query->post_count;
$count = 1;
?>
@derekshirk
derekshirk / acf-repeater-fields.php
Created March 7, 2015 02:08
ACF Repeater Fields
<?php
// check if the repeater field has rows of data
if( have_rows('repeater_field_name') ):
// loop through the rows of data
while ( have_rows('repeater_field_name') ) : the_row();
// display a sub field value
the_sub_field('sub_field_name');
@derekshirk
derekshirk / foundation-basic-row-12-columns.php
Created March 9, 2015 19:00
Foundation-basic-row-12-columns
<div class="row">
<div class="large-12 columns">
</div>
</div>
@derekshirk
derekshirk / css-overlay-no-blendmode.scss
Created March 9, 2015 19:32
CSS-overlay-no-blendmode
.overlay:before{
position: absolute;
content:"";
top:0;
left:0;
width:100%;
height:100%;
display: none;
z-index:0;
}
@derekshirk
derekshirk / WordPress-stylesheet-directory
Last active August 29, 2015 14:17
WordPress Get Stylesheet directory
<?php bloginfo('stylesheet_directory'); ?>
@derekshirk
derekshirk / WordPress-inline-svg-function
Last active August 29, 2015 14:17
WordPress-Inline-SVG-function
<?php
function grav_get_svg($svg){
$path = get_stylesheet_directory­().'/library/images­/svgs/'.$svg;
if(file_exists($path)){
return file_get_contents($path);­
} return '';
}
@derekshirk
derekshirk / rwd-media-queries-1
Last active August 29, 2015 14:17
rwd-media-queries-1
@media only screen and (min-width: 768px),
screen and (width:768px) and (resolution: 163dpi) {
}
@media only screen and (min-width: 960px) {
}
@derekshirk
derekshirk / gist:8206930479da994ca84a
Last active August 29, 2015 14:21
WP-Conditional_post_type_admin_screens
<?php
add_action( 'admin_enqueue_scripts', 'load_admin_custom_script' );
function load_admin_custom_script() {
$current_screen = get_current_screen();
if ( $current_screen->post_type === 'custom_post_type_name' ) {
$ss_url = get_bloginfo('stylesheet_directory');
wp_enqueue_script('jquery');
@derekshirk
derekshirk / wp-plugin-plugin-path-helpers
Created June 12, 2015 16:32
WP-Plugin-Handy-Plugin-Path-and-URL-Helpers
<?php
$file = dirname(__FILE__) . '/your-main-plugin-file.php';
$plugin_url = plugin_dir_url($file);
$plugin_path = plugin_dir_path($file);
@derekshirk
derekshirk / git-cli-aliaes
Last active August 29, 2015 14:23
Git-CLI-Aliases
##Use cli aliases.
I love git’s cli and prefer to use it most of times while performing active operations (commit, push, checkout etc.). There is a chance that you’ll get tired of typing the same command on and on and that’s when you find your life-saver represented by git aliases.
$ git config --global alias.co "checkout"
$ git config --global alias.cmm "commit -m"
$ git config --global alias.rh "reset HEAD"
$ git config --global alias.rhh "reset HEAD --hard"'