View .bash_aliases
alias please="sudo !!"
View js-hash-url.js
// get the HASH values
function getHashParams() {
var hashParams = {};
var e,
a = /\+/g, // Regex for replacing addition symbol with a space
r = /([^&;=]+)=?([^&;]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, ' ')); },
q = window.location.hash.substring(1);
View native-font-stack.css
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
View sword-toolkit.php
<?php
add_filter('sword_toolkit', function() {
return [
'remove_blog' => true,
'remove_post_tags' => true,
'remove_admin_bar' => true,
'remove_search' => true,
'remove_jquery_migrate' => true,
'remove_wp_head_junk' => true,
'remove_rest_api' => true,
View wordpress-convert-post-to-cpt.php
<?php
// probably wrap this in a hook, I often use `admin_notices` for easy UI access
add_action('admin_notice',function(){
echo "<pre>";
$posts = get_posts('numberposts=-1&post_type=post');
foreach ($posts as $apost) {
$terms = wp_get_post_terms( $apost->ID , 'category' );
foreach ($terms as $term) {
if ($term->name == 'Design') { // the cat name, can use $term->term_id instead
wp_update_post([
View template-include.php
<?php
add_filter('template_include', function ( $template ) {
if ( is_singular('location') ) {
$theme_files = array('single-location.php', 'myplugin/single-location.php');
$exists_in_theme = locate_template($theme_files, false);
if ( $exists_in_theme != '' ) {
return $exists_in_theme;
} else {
return plugin_dir_path(__FILE__) . 'single-location.php';
View google-map-geocode-form.html
<input type="text" name="location_meta[address]" placeholder="Street Address" value="">
<input type="text" name="location_meta[city]" placeholder="City" value="">,
<input type="text" name="location_meta[prov]" placeholder="State/Prov" value="">,
<select name="location_meta[country]">
<option value='CA'>🇨🇦</option>
<option value='US'>🇺🇸</option>
</select><br>
<input type="text" name="location_meta[postal]" placeholder="Postal/Zip" value="">
<button data-get-geo-cords>Click here to get Lat/Lng from address above</button>
View distance calculator for google maps.php
<?php
<h3>KM Calculator</h3><?php
$key = '************-******************************';
$thispage = '?'; // ex https://localhost/index.php
if (isset($_GET['from'])) {
$from = urlencode($_GET['from']);
$to = urlencode($_GET['to']);
View WP-disable-widgets.php
<?php
// Disable Default Dashboard Widgets @ https://digwp.com/2014/02/disable-default-dashboard-widgets/
add_action('wp_dashboard_setup', function () {
global $wp_meta_boxes;
// wp..
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);