Don’t Worry, You’re In The Right Place
A lot of these posts were originally on SureFireWebServices.com. So if you found them through search engines or clicking around, this is their new home :). Enjoy!

Tutorials

When was the last time you got hacked? Let's fix it!

I host a bunch of websites.  I love doing it because I’m in control of every aspect that goes on with them.  I can monitor server load, I can make edits to my server to install new versions of PHP, or mem_cache, or whatever.

One thing that I’ve been harping on a lot is security.  I have a plugin called Ninja Firewall on a few of my sites that monitors any file or DB change.

Now this never happened to me before but last night, around 11:30 (still awake, getting tired) I received 3 emails, back to back.

The first was Email Change, then New User Registration, then WordPress Login.

FLAG!

I know the user of the site personally so I KNOW that this is not normal behavior.  Also, the name that was being registered was none other than…. trump (dot) clinton at usa dot com! HAHAHA

So I actually got to stop this hack while it was going on, I felt like a super hero, lol.

So here are some steps that I did to remove the hack, because I’m finally getting good at this 🙂

Step 1 – Clean WordPress

The first thing I did was delete everything except the wp-content folder and the wp-config.php

This makes sure that any core affected files are gone!  After I delete them, I unzip a fresh download of WordPress, and upload all the files except for wp-content.

MAKE SURE YOU UPLOAD THE SAME VERSION OF WORDPRESS OR SH*T WILL BREAK.

Now I have a fresh WP install.

Step 2 – Go Into WP-Content

I keep all my builds as simple as possible so I have a pretty good grasp on what should and should not be in my WP-Content folder.  A great way to check would be to organize what’s in the WP-Content folder by edit date.  Check to see if anything was edited recently, and if it was a file, determine if you actually need that file.

A lot of times, what ends up outside of the plugins or themes folder is backups, caching files, things like that.  Verify the plugins on the site to make sure that those files are actually being used.  Most of the time, if you delete one of these files and then log into WordPress, you’ll get a warning or error message in your dashboard, so don’t stress too much. Delete what you don’t need.

Step 3 – Remove What You Don’t Use

Give your site a quick audit.  If you’re not using the 2015 theme, then remove it.  Anything you know for a fact you’re not using, delete it.  Plugins are a little trickier but do the date thing again.  See what was edited recently and check to see if it’s active on the site.  If it’s not, DELETE!

Step 4 – Do A Scan

I like to use the plugin Anti-Malware Security and Brute-Force Firewall.  It’s very thorough, and it’s free so you can’t beat it.  I don’t like using Sucuri or anything like that because to me, it’s always missing something.  I’ve had some great luck with the other plugin though and was able to fix/quarantine hacked files.

Step 5 – Harden Your Install

For this, I will either use the iThemes Security Plugin, or my favorite which is currently SecuPress.  Both are free, both will harden your website.  Just follow the instructions when you install them and you should be good to go!

BONUS – Track Things

If you want to take an additional step, you can install a file monitor.  I use NinjaFirewall (which is how I noticed all the things happening on the site).  But you can use whatever you feel comfortable with.  There are some site audit plugins out there that will email you when things happen on the website, so feel free to look into any of those.

ALWAYS BACK UP!

The worse case scenario is you can’t fix it.  Now what do you do? You can hire someone OR you can restore a clean back up.  So make sure you’re sites are always backed up!

If you’re reading this thinking to yourself, “man I don’t want to deal with that crap,” then let us help you out. We don’t offer clean up services, but we do host website which we treat as if they are our own!  Send your clients our way for hosting needs, we promise we’ll take care of them!  (White Labeled too, so you can take all the credit.)

Many to Many Posts Made Easy with Types, Views, and P2P

Many to many posts is a common problem that I keep running into with Types and so do a lot of others.  The main question most people ask is “How the hell do you successfully run many to many posts with the Types and Views plugin?”  Well to be honest, I’ve been developing for quite some time and it’s still a huge freakin’ pain to do, but I finally found a great way that will make life SO much easier for you in the future.

Why is many to many post relationships such a problem.

Well, for starters,  by default Types only allows many to many relationships by hacking it.  It’s not directly built into the software (not sure why as it’s been requested for years now).  In their documents, they tell you that in order to make many to many relationship type posts, you need to add a third CPT (custom post type).

This is ridiculous because:

  1. It doesn’t really work in every situation.
  2. It’s incredibly sloppy.
  3. Who wants to manage a third post type?!

In order to manage these relationships, you have to create tertiary posts that link the 2 posts together.  However, if you have “many to many” which is what’s needed, then you have to create a new post for every single relationship. Cumbersome? Yes

Doesn’t Types have Parent / Child Relations? Can’t you use that?

No.

Here’s how parent / child relationships work in Types.

You have a house (Parent). That house has bedrooms(Child).

You can list as many bedrooms as you want in that house.

NOW, What if you have 2 houses that both have a living room.  Not uncommon I’d say.  Well, since each child post can only have 1 parent, you have to recreate that living room on the parent post.  You can’t reuse child posts that were already created.

If you’re situation is more complex then that, then that’s going to leave you with A LOT of child posts. Now add that tertiary post in, and you can see how this can start getting very very messy.

Introducing P2P

Now I’m pretty new with this plugin but I did some digging and it truly is the definition of many to many relationships.  I think the problem most people have is that it involves a little bit of code.  Don’t be scared though, it’s really easy.

If we go back to the house/room example, you can make the living room once, and then just link it to every house if you need without having to constantly recreate the same post over and over.  The same works vice versa, create a room, and link it to as many houses as you want.

The Code

Here’s the magic that puts it all together, and you can also find this on the P2P documentation page.

First you have to set up the actual posts that need to be related:

[gist id=”4987734d263072362ad9″ file=”p2p_setup.php”]

Then you need to display it

[gist id=”4987734d263072362ad9″ file=”display_p2p.php”]

In the above example I used WooCommerce, so this specific loop hooks into the product summary, but you can literally hook it anywhere you’re theme allows.

That’s it! Now you have access to all the posts in a clean simple format, and they’ll display however you choose.

In my next post, I’ll show you how to actually set up the Views plugin to display the related posts.

Create an awesome blog page in 30 seconds with Beaver Builder and Genesis

The Beaver Builder Awesomeness Continues as I show you how easy and simple it is to build a blog page in 30 seconds (give or take a second).

Read More

Build a Landing Page with Beaver Builder and Genesis

In this post I’m going to take the Beaver Builder plugin a littler further.  I’m actually going to be building a live example of my Genesis Course landing page!  Read More

How to change the Add To Cart Link and Text on WooCommerce Archive Page

Well this was a pain to find.  In fact, I didn’t even find it, I ended up hacking a bunch of code together in order to figure it out.  But the good new, I did figure it out, and now I want to share it with you!  So anyone who’s been trying to change the text to the add to cart link for simple products on WooCommerce, I got you.  If you’re trying to change the LINK to the add to cart link so that it goes to the product page, I got you again!  Read More

How to disable AutoSave in WordPress

I have a few sites where this has been causing an issue. For some reason, when the post get’s autosaved, all the buttons disable, but they don’t come back!   Read More

Scroll to top