travis-taylor-sml

Travis Taylor

WordPress | PHP | Entrepreneur

Gravity Forms, Media Temple, and Email Spam. Are your Notifications being marked as Spam?

Recently I had an issue where notifications from any form on my server was either being marked as spam or not being received at all by my gmail account. I first contacted Gravity forms support and they advised me to download their logging tool here: Gravity Forms logging tool. However, after installing a setting up the tool I realized from the log that the problem was not Gravity forms, as per the logging form the php_mail function was sending and working properly. Next I contacted media temple to see if my server IP may have been blacklisted by Googles mail servers, but after running my IP through a tool they advised me that it was not blacklisted.

After tons of research I came across something called SPF, or the Sender Policy Framework. Basically, SPF is something that more advanced email servers are using now to detect and eliminate spam. Before it even gets to your spam folder! Luckily there is an easy solution to add an spf record to your domain name. If you’re using a dedicated virtual server from Media Temple, simply add this TXT DNS record to your domain names DNS settings:

v=spf1 a mx ip4:xxx.xxx.xxx.xxx -all

Just make sure to replace xxx.xxx.xxx.xxx with your servers IP address.

Then, when you are setting up your notifications in Gravity Forms, make sure the “from email” is wordpress@yourdomain.com. Then set the “reply-to” to the users email, or however you want to set that up.

Thats it! If you want to test your SPF record, you can run a test with the last form on this page.

If you are hosting multiple domain names. You will need to do this for each domain name. If you’re using something other than a DV, see this Media Temple support page.

Special Thanks to Yoast for writing this post on SPF

Woocommerce, how to use ajax to update shipping costs

I spent hours searching the web for an answer to this, only to find 6 people with the same question with no replies. So here’s the code I used for my shipping plugin:

function custom_checkbox_checker () {
if ( is_checkout() ) {
wp_enqueue_script( 'jquery' ); ?>
<script type="text/javascript">

jQuery(document).ready( function (e) {

var $ = jQuery;

// wc_checkout_params is required to continue, ensure the object exists
if ( typeof wc_checkout_params === 'undefined' )
return false;

var updateTimer,
dirtyInput = false,
xhr;

function update_shipping() {

if ( xhr ) xhr.abort();

$( '#order_methods, #order_review' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });

var liftgate = $( 'p.liftgate-checkbox .input-checkbox:checked' ).val();

var data = {
action: 'woocommerce_update_order_review',
security: wc_checkout_params.update_order_review_nonce,
liftgate: liftgate,
post_data: $( 'form.checkout' ).serialize()
};

xhr = $.ajax({
type: 'POST',
url: wc_checkout_params.ajax_url,
data: data,
success: function( response ) {
if ( response ) {
$( '#order_review' ).html( $.trim( response ) );
$( '#order_review' ).find( 'input[name=payment_method]:checked' ).trigger('click');
$( 'body' ).trigger('updated_checkout' );
}
}
});
}

jQuery('p.liftgate-checkbox .input-checkbox').on('click', function() {
update_shipping();

});

});

</script>
<?php }
}

add_action( 'wp_footer', 'custom_checkbox_checker', 50 );

Basically, you just want to replace “liftgate” with whatever the name of your checkbox is. This will automatically rerun your shipping calculator, so you want to include something like this in your calculate_shipping function to get the value:

$liftgate = isset($_POST['liftgate']) && $_POST['liftgate'] ? "1" : "0";

I hope someone else finds this useful, since there are no answers anywhere else.

Two sweet features in Filezilla to speed up your workflow

Double clicking on hundreds of files every time to need to replace a file in your WordPress theme can be a daunting task. If you open the “Advanced” section in your Site Manager, you can set the default local directory and the default remote directory:

Screen Shot 2013-09-14 at 6.01.38 PM

From here you can set it up to access the specific path you always need in your localhost and on your server. This makes syncing files from your localhost to your server much faster!

On the topic of syncing, you can also turn on directory comparison to view what files have been changed or added to either directory. Here’s what the icon looks like on FileZilla’s menu:

Screen Shot 2013-09-14 at 6.06.13 PM

And here’s what you’ll see upon activating:

Screen Shot 2013-09-14 at 6.07.18 PM

That’s all for now, enjoy!

Managing multiple WordPress sites with Multisite

As a new endeavor, we’ve been creating all of our new sites on our localhost with multisite. It is a bit of a learning curve moving from regular WordPress installs to Multisite, but the benefits seem to keep growing everyday.

The one thing that really confused me at first was using multiple plugins across sites. There are two ways to install a plugin for multisite. The first is Network Activate, which activates the plugin across all of your websites. This is great for plugins like Debug Bar or Gravity Forms but is not always a good idea for using something like an eCommerce plugin like WooCommerce. Since not of our websites are eCommerce, there is no need to have the plugin activated across all sites. If you don’t chose network activate and just install the plugin, then switch from network access to the individual site, you can then install the plugin specifically for that site. Thankfully with some email help from my good friend Austin @ Anchordev, I was able to figure this out quicker.

Another huge benefit to Multisite for theme developers is keeping all of your themes in one directory and being able to easily access older code to use on a new site you’re developing.

All in all, I’m still learning Multisite, but I can already tell this is something we’re going to be switching all of our sites to pretty soon. Figuring that out will be my next task.

Rayne, my newest WordPress Theme

Yesterday I decided that it was time for version 3 of my personal site travistaylor.com. After much inspiration from some great designers I follow on dribbble, I came up with this idea for a blog style WordPress theme (what you see right now). I really like how the designed turned out and I decided it couldn’t wait any longer and I developed the site in the same night… 2am came pretty quick.

This was my first time actually developing a custom commenting system for WordPress and I learned a lot from it. I kept adjusting the design all night and decided to add some CSS3 animation to the theme, which turned out to be icing on the cake. I’m very happy with the final result. I’ve decided to make the theme free and open-source on GitHub. Hopefully it will be up in the WordPress theme repository soon, but I know I want to make a few changes before that happens like adding a customizer option so users can change the colors of the theme.

Anyways, please feel free to post any feedback on the theme below. You can download or contribute to the theme here.

css.php