Skip to content

Instantly share code, notes, and snippets.

View jerrickhakim's full-sized avatar

Jerrick Hakim jerrickhakim

View GitHub Profile
{
"autocomplete": true,
"enable_auto_align": true,
"font_size": 10,
"format_on_save": true,
"ignored_packages":
[
"Vintage"
],
"php_bin": "/Applications/MAMP/bin/php/php7.0.0/bin/php",
@jerrickhakim
jerrickhakim / gist:846f5e26b1d7a13efabe55de41ce4d17
Created October 6, 2019 01:25
phpfmt Visual Code json settings - MAMP - MAC
{
"php.executablePath": "/Applications/MAMP/bin/php/php7.0.12/bin/php",
// Set the default
"editor.formatOnSave": false,
// Enable per-language
"[php]": {
"editor.formatOnSave": true
}
}
@jerrickhakim
jerrickhakim / WP Course App CSS Options
Last active September 2, 2018 20:21
WP Course App CSS Options
/* MENU CSS
----------------------------------------*/
/*change color of menu background*/
.side-nav {
background-color: #121212;
}
/*change color of close button*/
.side-nav .closebtn {
@jerrickhakim
jerrickhakim / gist:6405261e4b25cbce982eaea34deb9ea2
Created August 27, 2018 15:58
Change img src based on time example
// JERRICK'S STATUS JS
jQuery(function(){
// get current hour
var now = new Date(Date.now());
var hour = now.getHours();
var min = now.getMinutes()
var statustitle = jQuery('#jh_status').attr('title');
if (hour >= 0 & hour <=7 ) {
jQuery('#jh_status').attr('src', 'https://d33t7gcdmhxpn0.cloudfront.net/getting-out-of-bed.png'); jQuery('#status-text h2').text("Sleeping Zzzz...");
} else if (hour >= 8 & hour <= 9 ) { jQuery('#jh_status').attr('src', 'https://d33t7gcdmhxpn0.cloudfront.net/getting-out-of-bed.png'); jQuery('#status-text h2').text("Morning!!");
@jerrickhakim
jerrickhakim / WP Course App Basic Custom CSS
Created August 24, 2018 02:10
WP Course App Basic Custom CSS
/* MENU CSS
----------------------------------------*/
/*change color of menu background*/
nav#menu-wpca {
background: #0049ff;
}
/*change color of module title in advanced mode*/
h2.module-title {
@jerrickhakim
jerrickhakim / gist:85c258396491389fbfa836b4cbbb4bf7
Created June 20, 2018 04:56
Saving WordPress settings page with by an array
function wpca_sales_feed_save_settings(){
$wpca_sales_feed_save = array(
'wpca_show_for_logged_users',
'wpca_feed_begin',
'wpca_feed_begin',
'wpca_feed_show_for',
'wpca_cards_per_user',
'sales_feed_in_animation',
'sales_feed_out_animation',
<?php
$animation = array(
'none' => esc_attr__( 'None', 'wpca-sales-feed' ),
'bounce' => esc_attr__( 'bounce', 'wpca-sales-feed' ),
'flash' => esc_attr__( 'flash', 'wpca-sales-feed' ),
'pulse' => esc_attr__( 'pulse', 'wpca-sales-feed' ),
'rubberBand' => esc_attr__( 'rubberBand', 'wpca-sales-feed' ),
'shake' => esc_attr__( 'shake', 'wpca-sales-feed' ),
'headShake' => esc_attr__( 'headShake', 'wpca-sales-feed' ),
'swing' => esc_attr__( 'swing', 'wpca-sales-feed' ),
@jerrickhakim
jerrickhakim / gist:a54a352be47b54a87d9a412de6112fa7
Created May 21, 2018 02:54
Only admin can access WordPress Dashboard
// BLOCK WORDPRESS DASHBOARD
function block_dashboard() {
$file = basename($_SERVER['PHP_SELF']);
if (is_user_logged_in() && is_admin() && !current_user_can('edit_posts') && $file != 'admin-ajax.php'){
wp_redirect( home_url('/account') );
exit();
}
}
@jerrickhakim
jerrickhakim / gist:5d1feecb73b8179213b36db38eb7c3f9
Created May 12, 2018 03:04
WordPress Localize Script Example
add_action( 'wp_enqueue_scripts', 'monica_register_js' );
function monica_register_js() {
wp_register_script( 'monica-theme-js', get_template_directory_uri() . '/js/monica.js', array( 'jquery' ), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'monica_localize' );
@jerrickhakim
jerrickhakim / gist:8578dcd41edd9981795b19704ad485ff
Created May 7, 2018 18:39
Custom text above add to cart based on shipping class - WooCommerce
function custom_text_per_shipping_class() {
global $product;
$product = wc_get_product();
$shipping_class = $product->get_shipping_class();
if ($shipping_class == 'a'){
echo "a";
} elseif ($shipping_class == 'b') {
echo "b";
} else {