This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"terminal.integrated.defaultProfile.windows": "Command Prompt", | |
"php.validate.executablePath": "C:/Users/bbg20/.config/herd/bin/php83/php.exe", | |
"json.schemas": [ | |
{ | |
"fileMatch": ["/package.json"], | |
"url": "https://json.schemastore.org/package" | |
} | |
], | |
"workbench.editor.enablePreview": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from 'react'; | |
const useWindowWidth = () => { | |
const [windowWidth, setWindowWidth] = useState(window.innerWidth); | |
useEffect(() => { | |
const handleResize = () => { | |
setWindowWidth(window.innerWidth); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from 'react'; | |
const useDeviceDetection = () => { | |
const [device, setDevice] = useState(''); | |
useEffect(() => { | |
const handleDeviceDetection = () => { | |
const userAgent = navigator.userAgent.toLowerCase(); | |
const isMobile = | |
/iphone|ipad|ipod|android|blackberry|windows phone/g.test(userAgent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('contextmenu', event => event.preventDefault()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Colorado fee | |
/** | |
* Add a .27 surcharge to orders shipping to Colorado | |
* https://www.thathandsomebeardedguy.com/woocommerce-colorado-retail-delivery-fee/ | |
*/ | |
add_action('woocommerce_cart_calculate_fees', 'handsome_bearded_guy_custom_surcharge'); | |
function handsome_bearded_guy_custom_surcharge() { | |
global $woocommerce; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { registerBlockType } = wp.blocks; | |
registerBlockType( 'my-plugin/hello-world', { | |
title: 'Hello World', | |
icon: 'smiley', | |
category: 'common', | |
edit: () => { | |
return ( | |
<p>Hello World!</p> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Meta Box Example | |
Description: Example demonstrating how to add Meta Boxes. | |
Plugin URI: https://plugin-planet.com/ | |
Author: Jeff Starr | |
Version: 1.0 | |
*/ | |
// register meta box |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$tbl = $wpdb->prefix . 'posts'; | |
$post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", 1 ) ); // posts can reference in the phpstorm | |
$prefix_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $tbl WHERE ID = %d", 1 ) ); // phpstorm: unable to resolve ID | |
$prepare_query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", 1 ); | |
$prepare_result = $wpdb->get_col( $prepare_query ); // 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
defined( 'ABSPATH' ) || exit; | |
global $vap, $vap_sync; | |
$lastsync_option = $vap_sync->vap_get_lastsync(); | |
$ls_timestamp = $lastsync_option['timestamp']; | |
$ls_category = $lastsync_option['category']; | |
$ls_page = $lastsync_option['page']; |
NewerOlder