- Watch and follow along with at least the first 5 videos of this playlist
- At least the first 13 videos of this playlist
- Frameworks pick one and stick to it. ONLY after you get a solid foundation in vanilla JS above.
// Yoink: https://www.javascripttutorial.net/web-apis/javascript-formdata/ | |
const btn = document.querySelector('#submit-btn-id'); | |
const form = document.querySelector('#my-form-id'); | |
btn.addEventListener('click', (e) => { | |
// prevent the form from submitting | |
// or uncomment the debugger statment below for a breakpoint | |
// if needing to also send the data for testing | |
e.preventDefault(); |
<?php | |
// Yoink: https://www.wpbeginner.com/wp-tutorials/how-to-disable-the-search-feature-in-wordpress/ | |
// Tested on WordPress: 5.9.3 | |
// PHP: 8.0 | |
/* | |
Instead of going to a search page, show 404 instead | |
*/ | |
function wpb_filter_query( $query, $error = true ) { | |
if ( is_search() ) { |
When using a gravity form (multi-page, ajax) as a sticky modal for the bottom of the page, the generated anchor tag used to scroll interfears with the page scrolling.
The effect is when the user clicks the next button, the new page loads via ajax in the modal, but the gf js is trying to scroll to the top where the generated anchor tag is. But that's at the bottom of the page, so the page will auto scroll trying to keep up.
We can disable this behaviour with hooks. Add this to your themes function.php
Global disable
add_filter( 'gform_confirmation_anchor', '__return_false' );
<?php | |
/** | |
* Template Name: Homepage | |
*/ | |
get_header(); | |
// since this is the Front-Page we need to use "page" instead of "paged" | |
$paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1; | |
$args = array( |
# requires uszipcode | |
# $ pip install uszipcode | |
# zip.csv is a list of only zipcodes, one per each line | |
from sqlalchemy.sql.operators import op | |
from uszipcode import SearchEngine | |
from pprint import pprint | |
rtn = [] | |
zips = [] |
<?php | |
function validate_export( $filename ){ | |
$ext = explode(".", $filename); | |
if( $ext[1] && $ext[1] != "sql" ){ | |
return false; | |
} | |
if( $ext[2] && $ext[2] != "gz" ){ | |
return false; | |
} |
<?php | |
// yoink: https://wordpress.stackexchange.com/a/379641 | |
// add this to functions.php | |
function add_admin_column($column_title, $post_type, $cb){ | |
// Column Header | |
add_filter( 'manage_' . $post_type . '_posts_columns', function($columns) use ($column_title) { | |
$columns[ sanitize_title($column_title) ] = $column_title; | |
return $columns; | |
} ); |
ssh -L 33666:127.0.0.1:3306 <USER>@<IP OR DOMAIN> |