Skip to content

Instantly share code, notes, and snippets.

@nathaningram
nathaningram / styles.css
Last active November 18, 2024 15:59
Creating a Starter Site - Sample styles.css
/*
Theme Name: Kadence Client
Author: YOUR BUSINESS NAME HERE
Author URI: https://your-website.com
Description: A child theme for Kadence from YOUR BUSINESS NAME
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kadence-child
Template: kadence
@nathaningram
nathaningram / wp-config.php
Created November 9, 2021 21:29
Kadence Starter Site 2021 wp-config
<?php
/* Debug Options */
define( 'WP_DEBUG_LOG', false );
define( 'WP_DEBUG', false );
/* MySQL Settings */
define( 'DB_NAME', 'database_name_here' );
define( 'DB_USER', 'username_here' );
@nathaningram
nathaningram / no-user-enum.php
Created November 1, 2021 19:09
Stop WP User Enumeration
// Stop User Enumeration Scans
if (!is_admin()) {
// default URL format
if (preg_match('/author=([0-9]*)/i', $_SERVER['QUERY_STRING'])) die();
add_filter('redirect_canonical', 'ni_check_enum', 10, 2);
}
function ni_check_enum($redirect, $request) {
// permalink URL format
if (preg_match('/\?author=([0-9]*)(\/*)/i', $request)) die();
else return $redirect;
@nathaningram
nathaningram / hide_author_name.php
Last active October 21, 2021 19:26
Hide Author Name
//Hide Author Names to Stop WP User Enumeration Scans
function ni_redirect_to_home_if_author_parameter() {
$is_author_set = get_query_var( 'author', '' );
if ( $is_author_set != '' && !is_admin()) {
wp_redirect( home_url(), 301 );
exit;
}
}
@nathaningram
nathaningram / slug-as-class.php
Last active September 6, 2021 15:12
Add Post Slug as Body Class
//Add Page Slug to Body Class
function ni_add_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes; }
add_filter( 'body_class', 'ni_add_slug_body_class' );
@nathaningram
nathaningram / webp.php
Created August 16, 2021 19:37
Convert JPG > WebP
add_filter( 'image_editor_output_format', function( $formats ) {
$formats['image/jpeg'] = 'image/webp';
return $formats;
} );
@nathaningram
nathaningram / unset_default_image_sizes.php
Last active July 19, 2021 16:12
Unset Default WordPress Image Sizes
add_filter( 'intermediate_image_sizes_advanced', 'ni_remove_default_image_sizes' );
// Source quadlayers.com/remove-wordpress-default-image-sizes/
function ni_remove_default_image_sizes( $sizes ) {
unset($sizes['thumbnail']); // disable thumbnail size
unset($sizes['medium']); // disable medium size
unset($sizes['large']); // disable large size
unset($sizes['medium_large']); // disable medium-large size
unset($sizes['1536x1536']); // disable 2x medium-large size
unset($sizes['2048x2048']); // disable 2x large size
return $sizes;
@nathaningram
nathaningram / wepb.txt
Created March 4, 2021 18:01
Smush Local WebP Code for .htaccess
# BEGIN SMUSH-WEBP
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/./smush-webp/disable_smush_webp !-f
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{DOCUMENT_ROOT}/./smush-webp/$1.$2.webp -f
RewriteRule ^/?(.+)\.(jpe?g|png)$ /./smush-webp/$1.$2.webp [NC,T=image/webp,E=WEBP_image]
</IfModule>
@nathaningram
nathaningram / deconstruction-elementor.txt
Created December 29, 2020 18:53
Deconstruction: Brilliantly.net (Elementor Notes from Doug V)
These notes were provided from DougV for using the concepts from this webinar in Elementor and WPForms. Thanks Doug!
=============
Add Plugin
https://wordpress.org/plugins/dynamicconditions/
Dynamic Conditions by RTO GmbH
How to Show/Hide Elementor Section Based on URL
@nathaningram
nathaningram / cta-button.html
Created December 16, 2020 18:11
Call to Action Button Settings
Button Text:
[wpbb-if post:pods_display field=page_cta]
[wpbb post:pods_display field='page_cta']
[wpbb-else] Schedule a Discovery Call
[/wpbb-if]
Button Link: