Tools

Email Deliverability

SPF Record (TXT or SPF record)

Hostname: @ OR [ma]
Value: v=spf1 a mx ip4:[ip address] ~all

DKIM (TXT record)

Obtain from mail server. Looks like:

Hostname: [mailo.]_domainkey.[mg]
Value: k=[rsa]; p=[y6t7tfygjkbkhygu7t8…]

DMARC (TXT record)

Hostname: _dmarc.[mg]
Value: v=DMARC1; p=none;

Redirection

Javascript Redirect
				
					<script type="text/javascript">
    window.parent.location.href = "https://newdomain.com/"
</script>
				
			
Login Redirect URLs

………………https://[domain]/wp-login.php/?redirect_to=https%3A%2F%2F[domain]%2[permalink]%2F[page]%2F&reauth=1

Media

Find Image Aspect Ratio

Height / Width * 1, 2, 3, 4… until the result is a whole number.

Ex. 560 / 720 * 9 = 7 (Aspect Ratio is 9:7)

Code Tips

PHP

‘ ‘ used to echo phrases

. to concatenate

$[term] to define a variable

echo to display content

$post (WP_Post) The post object for the current post.

$authordata (WP_User) The author object for the current post

Branding

Copyright Footer
				
					Copyright © 

All Rights Reserved | Website by <a href="https://arcfires.us">ArcFires</a>
				
			

General HTML

hr divider styling
				
					hr {
	border-color: #B78E2C;
	border-width:3px;
	background-color: #B78E2C;
	border-top: none;
	border-left: none;
	border-right: none;
}
				
			
Bullet List Spacing
				
					ul, ol {
    margin-bottom: 0.9rem;
}
				
			
WordPress Tooltips Plugin Shortcode
				
					[tooltips keyword="
content="tooltip"]
				
			
Table Border Colors
				
					table td, table th {
    border: none;
}
				
			
Table alternating row colors
				
					table tbody>tr:nth-child(odd)>td {
    background-color: #ffffff !important;
}
				
			
Table row colors on hover
				
					tr:hover td {
    background-color: #ffffff !important;
}
				
			
Download Attribute
				
					download | filename.pdf
				
			
Text Alignment (Vertical and Horizontal)
				
					// Place on div containing text
.center {
  border: 2px solid red;
  display: flex;
  justify-content: center;
  height: 12em;
  align-items: center;
}

// Alternative Method
.heading-div {
  width: 80%;
  border-style: solid;
  border-width: 1px;
  border-color: #000;
  margin: auto;
  padding: 10px;
}
.heading {
  margin: auto;
  border-width: 1px;
  border-style: solid;
  border-color: red;
  text-align: center;
  height: 12em;
  line-height: 12em;
}
				
			

WordPress

BuddyPress Dynamic Usernames in URLs
				
					https://schooloflifemastery.com/members/me/courses/

// "me" is dynamically replaced with the username
				
			
Define current user information
				
					<?php $current_user = wp_get_current_user(); ?>

<?php $current_user_id = get_current_user_id(); ?>
				
			
Display all user data
				
					<?php

$current_user = wp_get_current_user();

echo 'Username: '.$current_user->user_login.'<br>';
echo 'Email: '.$current_user->user_email.'<br>';
echo 'First Name: '.$current_user->user_firstname.'<br>';
echo 'Last Name: '.$current_user->user_lastname.'<br>';
echo 'Display Name: '.$current_user->display_name.'<br>';
echo 'User ID: '.$current_user->ID.'<br>';

?>
				
			
Embed iFrame
				
					<iframe src="" height="680" width="940" style="border-style:solid; border-color:#e6e6e6; border-width:1px;"></iframe>
				
			
Add PHP Custom Post Types
				
					// Register Post Types

$init->registerPostTypes([
	'people' => [
		'plural'    => 'People',
		'singular'  => 'Person',
		'supports'  => ['title', 'editor', 'excerpt'],
		'permaLink' => 'leaders/board/{slug}',
		'public'    => true
	],
	'media' => [
		'plural'    => 'Media Posts',
		'singular'  => 'Media Post',
		'supports'  => ['title', 'editor', 'excerpt'],
		'permaLink' => 'media/the-front/{slug}',
		'public'    => true
	],
	'publication' => [
		'plural'    => 'Publications',
		'singular'  => 'Publication',
		'supports'  => ['title', 'excerpt'],
		'permaLink' => 'publications/category/{slug}',
		'public'    => true
	],
	'tmg_update' => [
		'plural'   => 'TMG Updates',
		'singular' => 'TMG Update',
		'supports' => ['title', 'editor'],
		'public'   => false,
		'search'   => false
	],
	'tmg_contact' => [
		'plural'   => 'TMG Contacts',
		'singular' => 'TMG Contact',
		'supports' => ['title'],
		'public'   => false,
		'search'   => false
	],
	'tmg_toolbox' => [
		'plural'   => 'TMG Toolbox',
		'singular' => 'TMG Toolbox',
		'supports' => ['title'],
		'public'   => false,
		'search'   => false
	],
	'tmg_media' => [
		'plural'    => 'TMG Media',
		'singular'  => 'TMG Media',
		'supports'  => ['title', 'editor'],
		'public'   => true,
		'permaLink' => 'account/media/{slug}',
		'search'   => false
	],
	'quote' => [
		'plural'    => 'Quotes',
		'singular'  => 'Quote',
		'supports'  => ['title'],
		'public'    => false,
		'search'    => false
	],
]);
				
			

WooCommerce

Disable WooCommerce Image Zoom
				
					add_action( 'after_setup_theme', 'remove_pgz_theme_support', 100 );

function remove_pgz_theme_support() { 
remove_theme_support( 'wc-product-gallery-zoom' );
}
				
			
Add to Cart Link
				
					[website.com]/cart/?add-to-cart=[ID]?variation_id=[SKU]
				
			
"View Cart" Button Spacing (After Add to Cart)
				
					a.added_to_cart.wc-forward {
    padding: 10px;
}
				
			
Customize WooCommerce Order Confirmation Page
				
					add_filter('woocommerce_thankyou_order_received_text', 'woo_change_order_received_text', 10, 2 );
function woo_change_order_received_text( $str, $order ) {
    $new_str = $str . ' You will receive the receipt via email shortly.;
    return $new_str;
}
				
			
Expand Width of Cart Coupon Field
				
					input#coupon_code {
    width: 55%;
}
				
			

Advanced Custom Fields

ACF Dynamic Token
				
					// /* [acf:action_item_2_action_heading_2] */
				
			
Dynamic.ooo Raw PHP ACF Field
				
					the_field('action_item_2_action_icon_2');
				
			
Advanced Custom Field PHP
				
					<?php the_field('field_title'); ?>
				
			
Display ACF Author Field
				
					<?php 

$author_id = get_the_author_meta('ID');
the_field('company_name', 'user_'.$author_id); 

?>
				
			
Work Log ACF Field HTML
				
					<iframe src="" height="680" width="940" style="border-style:solid; border-color:#e6e6e6; border-width:1px;"></iframe>
				
			
Work Log ACF Field HTML
				
					<iframe src="" height="680" width="940" style="border-style:solid; border-color:#e6e6e6; border-width:1px;"></iframe>
				
			
ACF Use Example
				
					<?php 

$author = get_field('author');

get_header(‘’);?>

<section class=“page”>
	<div class=“container”>

		<h1><?php the_title();?></h1>

		<pre><?php // echo print_r($author);?></pre>

		<strong><?php echo $author[‘user_firstname’];?> <?php echo $author[‘user_lastname’];?></strong>

	</div>
</section>


<?php get_footer();?>
				
			
ACF Simple Text-Based Fields Shortcode
				
					[acf field="field_name" post_id="123"]

This is a story about a boy named [acf field="name"]. He is [acf field="age"] years old.
				
			
Basic ACF PHP Functions
				
					get_field() // Returns the value of a specific field.
get_field_object() // Returns the settings of a specific field.
get_field_objects() // Returns the settings of all fields saved on a specific post.
get_fields() // Returns an array of field values (name => value) for a specific post.
the_field() // Displays the value of a specific field.
				
			
Format Number Fields as Phone Numbers
				
					// Return ACF number fields with commas
add_filter('acf/format_value/name=party_leader_phone_number', 'formatPhoneNumber', 20, 3);
function formatPhoneNumber($value, $post_id, $field) {
    $value = preg_replace('/[^0-9]/','',$value);

    if(strlen($value) > 10) {
        $countryCode = substr($value, 0, strlen($value)-10);
        $areaCode = substr($value, -10, 3);
        $nextThree = substr($value, -7, 3);
        $lastFour = substr($value, -4, 4);

        $value = '+'.$countryCode.' ('.$areaCode.') '.$nextThree.'-'.$lastFour;
    }
    else if(strlen($value) == 10) {
        $areaCode = substr($value, 0, 3);
        $nextThree = substr($value, 3, 3);
        $lastFour = substr($value, 6, 4);

        $value = '('.$areaCode.') '.$nextThree.'-'.$lastFour;
    }
    else if(strlen($value) == 7) {
        $nextThree = substr($value, 0, 3);
        $lastFour = substr($value, 3, 4);

        $value = $nextThree.'-'.$lastFour;
    }

    return $value;
}
				
			

General CSS

Hide Elementor form field labels without removing them
				
					label.elementor-field-label {
    display: none;
}
label#bs_ebcaptchatext {
    display: contents;
}
				
			
Helpful CSS
				
					/* ELEMENTOR CSS */
/* Remove elementor form labels */
label.elementor-field-label {
    display: none;
}
/* Add spacing to inner sections */
.elementor-section .elementor-inner-section {
    margin-bottom: 10px;
}
label#bs_ebcaptchatext {
    display: contents;
}

/* CONTENT CSS */
/* Add padding to the bottom of lists */
ul, ol {
    margin-bottom: 0.9rem;
}

/* LEARNDASH STYLING */
.ld-course-status-action form {
    padding-right: 10px;
}

/* POST STYLING */
blockquote {
    border-left: solid 2px;
		border-color: #E29E21;
    padding-left: 15px;
}
				
			
Mobile Responsiveness CSS
				
					@media only screen and (max-width: 600px) {
  body {
    background-color: lightblue;
  }
}
				
			
Theme Editor CSS for WordPress Admin Dashboard
				
					// CUSTOM CSS STYLING IN WORDPRESS ADMIN DASHBOARD — VERY IMPORTANT
/* Globally disable Back to WordPress Editor button */
/* Hide the Back to WordPress Editor button… Would break pages built with Elementor. */
/* Shrink the height of the Elementor Edit Page Content section to make custom fields more visible */
add_action('admin_head', 'my_custom_style'); // admin_head is a hook my_custom_fonts is a function we are adding it to the hook
function my_custom_style() {
  echo '<style>
    #elementor-switch-mode .elementor-switch-mode-on{
        display: none;    
    }
	body.elementor-editor-active #elementor-switch-mode-button{
	visibility: hidden;
	}
	body.elementor-editor-active #elementor-switch-mode-button:hover{
	visibility: hidden;
	}
	#elementor-editor{
	height: 100px;
	}
  </style>';
}
				
			
Infusionsoft Form Styling
				
					<style>
label {
    display: none;
}
.infusion-field {
    margin-bottom: 15px;
}
input#inf_field_FirstName, input#inf_field_Email {
    width: 100%;
    border: none;
    padding: 15px;
    border-radius: 5px;
}
form#inf_form_3ab56deb37c5e3fe72f1a21b99d3e86a {
    padding: 15px;
}
button#recaptcha_3ab56deb37c5e3fe72f1a21b99d3e86a {
    border: none;
    padding-top: 15px;
    padding-bottom: 15px;
    width: 100%;
    border-radius: 5px;
    background-color: #FFAD31;
    color: white;
}
</style>
				
			
Sticky Elementor Header
				
					.elementor-sticky--effects { background-color: #000; 
}
.elementor-sticky--effects .logo img {
width: 50% !important;
}


.e-header {
    position: absolute;
    width:100% !important;
}

.elementor-sticky--effects { background-color: #19405A; 
    transition: background-color 0.5s ease !important;
}
.elementor-sticky--effects .logo img {
    width: 75% !important;
}
.logo img {
transition: width 2s ease !important;
}
				
			
BuddyBoss Left Menu Icons
				
					.welcome-menu-icon .fa-file:before {
	content: "\f005";
}
.my-courses-menu-icon .fa-file:before {
	content: "\f19d";
}
				
			

General PHP

General Javascript

Close First Elementor Toggle Option by Default
				
					<script> 
jQuery(document).ready(function($) { 
var delay = 100; setTimeout(function() { 
$('.elementor-tab-title').removeClass('elementor-active');
 $('.elementor-tab-content').css('display', 'none'); }, delay); 
}); 
</script>
				
			

Edit wp-config.php File

Fix "Password Strength Unknown"
				
					# Add to wp-config.php after the < php line
$_SERVER['HTTPS'] = true;
				
			
Apache /[domain.com].conf
				
					<VirtualHost *:80>
    ServerName arcfires.us
    ServerAlias www.arcfires.us
    DocumentRoot /var/www/jacob/arcfires.us
    ErrorLog /var/log/apache2/arcfires.us-error.log
    CustomLog /var/log/apache2/arcfires.us-access.log combined
    <Directory /var/www/jacob/arcfires.us>
        AllowOverride All
        Require all granted
    </Directory>
    <IfModule mod_rewrite.c>
        # Strips out www from the domain
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^www\.arcfires\.us$ [NC]
        RewriteRule ^ http://arcfires\.us%{REQUEST_URI} [R=301,L]
    </IfModule>
    # Next 3 lines added by Let's Encrypt. Redirects to https. First condition is irrelevant with the redirect above.
    RewriteCond %{SERVER_NAME} =www.arcfires.us [OR]
    RewriteCond %{SERVER_NAME} =arcfires.us
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    
</VirtualHost>
				
			
Apache /[domain.com]-ssl.conf (Cloudflare SSL)
				
					<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName arcfires.us
    ServerAlias www.arcfires.us
    DocumentRoot /var/www/jacob/arcfires.us
    ErrorLog /var/log/apache2/arcfires.us-error.log
    CustomLog /var/log/apache2/arcfires.us-access.log combined
    <Directory /var/www/jacob/arcfires.us>
        AllowOverride All
        Require all granted
    </Directory>
    <IfModule mod_rewrite.c>
        # Strips out www from the domain
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^www\.arcfires\.us$ [NC]
        RewriteRule ^ http://arcfires\.us%{REQUEST_URI} [R=301,L]
    </IfModule>

</VirtualHost>
</IfModule>
				
			
Apache /[domain.com]-le-ssl.conf (Let's Encrypt SSL)
				
					<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName healingofamerica.net
    ServerAlias www.healingofamerica.net
    DocumentRoot /var/www/jacob/healingofamerica.net
    ErrorLog /var/log/apache2/healingofamerica.net-error.log
    CustomLog /var/log/apache2/healingofamerica.net-access.log combined
    <Directory /var/www/jacob/healingofamerica.net>
        AllowOverride All
        Require all granted
    </Directory>
    <IfModule mod_rewrite.c>
        # Strips out www from the domain
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^www\.healingofamerica\.net$ [NC]
        RewriteRule ^ http://healingofamerica\.net%{REQUEST_URI} [R=301,L]
    </IfModule>

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/healingofamerica.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/healingofamerica.net/privkey.pem
# SSLCertificateFile /etc/cloudflare/arcfires.key
# SSLCertificateKeyFile /etc/cloudflare/arcfires.pem

</VirtualHost>
</IfModule>
				
			

Edit .htaccess File

Link expired error: Add to .htaccess file
				
					php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300
				
			
Prevent Website Directory Listing
				
					Options -Indexes
				
			
Domain Level Redirect with .htaccess
				
					# This allows you to redirect your entire website to any other domain 
Redirect 301 / http://example.com/