Skip to content

Instantly share code, notes, and snippets.

View bstonedev's full-sized avatar

Brett Stone bstonedev

View GitHub Profile
@bstonedev
bstonedev / is_page_template.php
Created March 16, 2020 02:00
Conditional for if Template is being used
<?php
if ( is_page_template( 'template-name.php' ) ) {
// template-name.php is used
}
?>
@bstonedev
bstonedev / theme-starter-code-snippets-functions.php
Created March 17, 2020 22:07
WP Theme Starter Code Snippets for Functions.php
<?php
/**
* Remove admin bar
**/
add_filter('show_admin_bar', '__return_false');
/**
* Register Custom Post Type
**/
@bstonedev
bstonedev / performance-boost-code-snippets-functions.php
Created April 6, 2020 21:37
code snippets for functions.php to increase performance
<?php
/**
* Disable jQuery Migrate in WordPress.
*
*/
function crave_remove_jquery_migrate( &$scripts) {
if(!is_admin()) {
$scripts->remove('jquery');
}
@bstonedev
bstonedev / get-all-class-names.js
Last active April 8, 2020 07:06
JavaScript code snippet to get list of all CSS class names in HTML file
var used = [];
var elements = null;
var skipelements = [
'nav'
];
//get all elements
if (typeof document.getElementsByTagName != 'undefined') {
elements = document.getElementsByTagName('*');
}
@bstonedev
bstonedev / acf-repeater-field-loop-methods.php
Created April 13, 2020 01:52
Different loops thru ACF Repeater Fields
<?php
/*
// Method 0: while-loop
*/
if( have_rows('repeater_field_name') ):
while ( have_rows('repeater_field_name') ) : the_row();
?>
<h2>Sub Field: <?php the_sub_field('sub_field_name'); ?></h2>
@bstonedev
bstonedev / theme-kit-commands.md
Created April 15, 2020 07:39
Top 3 Shopify Theme Kit Commands

Get

theme get --password=[your-api-password] --store=[your-store.myshopify.com] --themeid=[your-theme-id]

Watch

theme watch --password=[your-api-password] --store=[your-store.myshopify.com] --themeid=[your-theme-id]

Get Theme ID

theme get --list -p=[your-api-password] -s=[your-store.myshopify.com]

@bstonedev
bstonedev / www-to-non-www-https.txt
Last active May 14, 2020 22:13
My fav 'redirect www URLs to non-www https URLs' .htaccess snippet
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
@bstonedev
bstonedev / tasks-in-mac-os-activity-mointor-that-are-ok.md
Last active November 16, 2021 00:34
List of Tasks in macOS activity monitor that are ok

For another great resource on this topic, see https://gist.github.com/miguelmota/201895350b8fd10622032e0fbad8cee4

Task Description Reference
launchd macOS 'service management framework' howtogeek.com
sysmond System Monitor Daemon, monitors all system activity in background and automated by launchd stackoverflow.com
kernel_task It's the kernel! howtogeek.com
hidd This daemon interprets all of your mouse movements and keyboard taps howtogeek.com
mds / mdworker / mds_stores These processes are part of macOS's Spotlight search tool [howtogeek.com](https://www.howtogeek.com/
@bstonedev
bstonedev / terminal-commands.txt
Created June 7, 2020 00:33
MacOS Terminal Commands - Quick Reference
## Controls ##
control D # exit bash session
## Commands ##
file # show file type
cat # show file content in terminal
less # use page reader in termainl
open # open file
ls # list files in directory
ls a* # list all files that start with an 'a'
@bstonedev
bstonedev / wp-security-checklist.md
Last active June 19, 2020 22:29
WordPress Security Checklist
  • use SFTP (Port: 22) to tranfer files
  • scan for vulnerabilities using WPScan: https://wpscan.org/
  • require 2FA for any users with 'Administrator' access
  • give clients 'Editor' access and below
  • revoke DROP, ALTER and GRANT privileges in MySQL database
  • add define('DISALLOW_FILE_EDIT', true); to wp-config.php
  • setup regular backups via installatron or preferred wp plugin
  • setup firewalls at WordPress level (Wordfence), Web Application level and CDN (if required)
  • remove WordPress version number from header