Skip to content

Instantly share code, notes, and snippets.

View johnpdang's full-sized avatar

jd johnpdang

  • San Diego, CA
View GitHub Profile
@johnpdang
johnpdang / functions.php
Last active April 20, 2021 16:37
EE - google calendar shortcode
/* This filter allows you to add custom shortcodes to the message system
* $shortcodes is an array of the available shortcodes for the current library
* $lib is the current shortcode library
*/
function ee_register_new_custom_messages_shortcodes( $shortcodes, EE_Shortcodes $lib ) {
//Add a shortcode to be used with the EE Datetimes within messages
if ( $lib instanceof EE_Datetime_Shortcodes ) {
//Add your shortcode to the add as the key, the value should be a description of the shortcode.
$shortcodes['[GOOGLE_CAL_LINK_*]'] = _('Google Calendar link');
@johnpdang
johnpdang / .gitignore
Created August 21, 2020 16:54
Specifies intentionally untracked files to ignore
# OSX
.DS_Store
# windows
Desktop.ini
# ignore everything in the root except the "wp-content" directory.
!wp-content/
# ignore everything in the "wp-content" directory, except:
@johnpdang
johnpdang / functions.php
Last active May 18, 2020 22:16
Browser and OS body classes
<?php
function mv_browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
@johnpdang
johnpdang / alm-filtering.js
Created May 10, 2020 00:11
Wordpress Ajax Load More advanced filtering with multiple custom taxonomies
// Advanced Filtering
$(document).ready(function () {
var alm_is_animating = false; // Animating flag
var buttons = $('.filter-tag .btn');
// Btn Click Event
$(document).on('click', '.filterTrigger .btn', function (e) {
e.preventDefault();
// Prevent any action while animating or with disabled class
@johnpdang
johnpdang / package.json
Last active May 9, 2020 23:44
Webpack Config
{
"name": "dev",
"version": "1.0.0",
"description": "Requires at least: WordPress 4.7 Tested up to: WordPress 5.0-trunk Version: 1.0",
"main": "webpack.config.js",
"scripts": {
"build": "webpack",
"watch": "webpack --watch",
"dev": "webpack --watch --progress --mode=development",
"prod": "webpack --watch --mode=production"
const tabs = () => {
$(".nav-tabs a").click(function () {
$('.nav-tabs a').removeClass('active');
$(this).tab('show').blur().addClass('active');
const link_text = $(this).html();
const tab_trigger = $(this).closest('.tabs-dropdown-wrap').prev('.tab-dropdown-trigger');
tab_trigger.html(link_text);
if($(window).innerWidth() < 991){
$(this).closest('.tabs-dropdown-wrap').slideUp();
@johnpdang
johnpdang / post-filtering.js
Last active May 9, 2020 23:35
Post Filtering
$(document).ready(() => {
if(!$('.alm-filter-nav').length){
return;
}
// Animation flag
var alm_is_animating = false;
// Set initial active item
document.querySelector('.alm-filter-nav li:first-child').classList.add('active'); // Set initial active state
@johnpdang
johnpdang / gist:27c57e0eb33b3fb3203f
Last active August 29, 2015 14:27
Sublime User Preferences
{
"color_scheme": "Packages/LastNight2.tmTheme",
"ignored_packages":
[
"Vintage"
],
"soda_classic_tabs": true,
"soda_folder_icons": true,
"theme": "Soda Dark.sublime-theme"
}