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
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 ArcFires
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
Display all user data
user_login.'
';
echo 'Email: '.$current_user->user_email.'
';
echo 'First Name: '.$current_user->user_firstname.'
';
echo 'Last Name: '.$current_user->user_lastname.'
';
echo 'Display Name: '.$current_user->display_name.'
';
echo 'User ID: '.$current_user->ID.'
';
?>
Embed 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
Display ACF Author Field
Work Log ACF Field HTML
Work Log ACF Field HTML
ACF Use Example
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 '';
}
Infusionsoft Form Styling
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
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
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
AllowOverride All
Require all granted
# Strips out www from the domain
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.arcfires\.us$ [NC]
RewriteRule ^ http://arcfires\.us%{REQUEST_URI} [R=301,L]
# 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]
Apache /[domain.com]-ssl.conf (Cloudflare SSL)
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
AllowOverride All
Require all granted
# Strips out www from the domain
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.arcfires\.us$ [NC]
RewriteRule ^ http://arcfires\.us%{REQUEST_URI} [R=301,L]
Apache /[domain.com]-le-ssl.conf (Let's Encrypt SSL)
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
AllowOverride All
Require all granted
# Strips out www from the domain
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.healingofamerica\.net$ [NC]
RewriteRule ^ http://healingofamerica\.net%{REQUEST_URI} [R=301,L]
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
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/