Skip to content

Instantly share code, notes, and snippets.

View currentcreative's full-sized avatar

Current Creative currentcreative

View GitHub Profile
@cdsaenz
cdsaenz / bs5-navwalker.php
Last active April 22, 2025 18:17
Wordpress Bootstrap 5 Nav Walker With Multiple Levels
<?php
/**
* CSDev - Bootstrap 5 wp_nav_menu walker
* Supports WP MultiLevel menus
* Based on https://github.com/AlexWebLab/bootstrap-5-wordpress-navbar-walker
* Requires additional CSS fixes
* CSS at https://gist.github.com/cdsaenz/d401330ba9705cfe7c18b19634c83004
* CHANGE: removed custom display_element. Just call the menu with a $depth of 3 or more.
*/
class bs5_Walker extends Walker_Nav_menu
// load all dependencies. gulp-* dependencies are
// all loaded at once by gulp-load-plugins
var gulp = require("gulp");
var del = require("del");
var plugins = require("gulp-load-plugins")();
var autoprefixer = require("autoprefixer");
var cssnano = require("cssnano");
var cssmqpacker = require("css-mqpacker");
var uncss = require("postcss-uncss");
var pngquant = require("imagemin-pngquant");
@bradtraversy
bradtraversy / mysql_cheat_sheet.md
Last active April 23, 2025 12:49
MySQL Cheat Sheet

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@Maxghp
Maxghp / Stop all vimeo video
Created January 8, 2018 11:02
Stop all vimeo video when close modal
//stop all vimeo videos when close
//jquery require
$(function(){
$('.modal, .close').click(function(){
$("iframe").each(function() {
var src= $(this).attr('src');
$(this).attr('src',src);
});
});
});
@zgordon
zgordon / wp-nav-menu-parameters.php
Last active January 7, 2024 05:15
Demo of the possible menu parameters for wp_nav_menu
<?php
$args = [
// Location pickable in Customizer
'theme_location' => 'main-menu',
// Assigns a default menu to location
'menu' => 'Main Menu',
// Main wrapper around the ul of posts
'container' => 'div',
'container_class' => 'container-class',
'container_id' => 'container-id',
@currentcreative
currentcreative / sample-plugin.php
Created January 5, 2017 21:01 — forked from brianhogg/sample-plugin.php
Example of is_new
<?php
/*
Plugin Name: Sample Plugin
Plugin URI: https://brianhogg.com/
Description: Showing is_new
Version: 1.0
Author: Brian Hogg
Author URI: https://brianhogg.com
License: GPLv2 or later
*/
@verticalgrain
verticalgrain / srcset.php
Created December 20, 2016 18:46
Wordpress srcset snippet for ACF image field
<?php
// Use an ACF image field
// Set the 'return value' option to "array" (this is the default)
// This example uses three image sizes, called medium, medium_large, thumbnail
$imageobject = get_field('image');
if( !empty($imageobject) ):
echo '<img alt="' . $imageobject['title'] . '" src="' . $imageobject['sizes']['medium'] . '" srcset="' . $imageobject['sizes']['medium_large'] .' '. $imageobject['sizes']['medium_large-width'] .'w, '. $imageobject['sizes']['medium'] .' '. $imageobject['sizes']['medium-width'] .'w, '. $imageobject['sizes']['thumbnail'] .' '. $imageobject['sizes']['thumbnail-width'] .'w">';
endif;
?>
@Atlas7
Atlas7 / remove_postgres_on_mac_os.md
Last active March 23, 2023 13:02
Note - How completely uninstall PostgreSQL 9.X on Mac OSX

This blog post has helped me clean up my postgres development environment on Mac. So making a copy!

How completely uninstall PostgreSQL 9.X on Mac OSX

This article is referenced from stackoverflow:

If installed PostgreSQL with homebrew , enter brew uninstall postgresql

If you used the EnterpriseDB installer , follow the following step.
@lschatzkin
lschatzkin / WP_Query-count
Created September 28, 2015 18:51
count number of posts in WP_Query results $post_count = $freereads_query->found_posts;
$my_query = new WP_Query($freereads_args);
$post_count = $my_query->found_posts;
@aibrean
aibrean / image-array.php
Last active March 25, 2024 07:25
Demystifying the ACF image field. ACF (Advanced Custom Fields) allows users to use an ID, array, or URL for images. Once the field is set up in ACF, it’s up to you to get it to work correctly in your template/theme. This is known as the “return value” in ACF.
<?php
$image = get_field('image'); // assigns the image field to the variable of $image
if( !empty($image) ){ ?> <!-- if the $image variable isn't empty, display the following: -->
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> <!--displays the URL for the image variable and also the alt tag which is entered in the WordPress media library-->
<?php }; ?> <!--ends the if statement -->