Linux, Security, SSH, WordPress,

Updated: How to find and clean up infected WordPress Files over SSH

Several years ago, I wrote what was and still is one of my most popular blogs to date. It’s an article where I provided some tips and tricks on finding infected WordPress files on your server. These days I’m doing … Continued

Read More..02, May 2020
Development, Magento,

How to find out what user used what coupon code in Magento

The Problem with Magento and Coupon Codes Magento comes pre-built with a ton of great reporting options for things like sales, shopping cart, products, customer reviews and more. Unfortunately within Magento there is no easy way to get an exported … Continued

Read More..02, Jun 2016
Development, Systems Administration, WordPress,

Use wpcli and Cron to Unpublish WordPress page

The Situation Have you ever found yourself in a situation where you need to automatically unpublish a specific blog post or page in WordPress? Maybe you need to take down a contest late at night, remove a blog article or … Continued

Read More..14, May 2016
Development, Linux, SSH, Systems Administration,

Easily monitor uptime on WHM & cPanel Server with UptimeRobot

It’s all about UptimeRobot When managing multiple WHM servers with hundreds of cPanel accounts, sometimes you need a quick and easy way to monitor your sites uptime. many of you may be aware of the service Uptime Robot. If not, … Continued

Read More..06, May 2016
Development, PHP, WordPress,

Remove Visual Composer from WordPress Excerpt

If you’ve ever been in a situation where you’re using Visual Composer within a site and you need to pull in an excerpt in a way that doesn’t include any shortcodes you can use the below functions to make that … Continued

Read More..04, May 2016
Development, Linux, Systems Administration,

Easily deploy a templated robots.txt file to all accounts within your WHM / cPanel server.

Ever need to quickly deploy a robots.txt template across all accounts on a WHM / cPanel server? The script below will allow you to do just that. It’s great for using in conjunction with a CRON job on your system … Continued

Read More..19, Apr 2016
Uncategorized,

Force Non Legacy Backup to Start (WHM/cPanel)

If you have setup a Backup to run in WHM -> Backup -> Backup Configuration and would like to force it to run immediately instead of waiting for the backup schedule you can do so through SSH. 1. Login to … Continued

Read More..02, Feb 2016
Development, Linux, PHP, WordPress,

WordPress Bash Scripts

I’ve been doing a lot of bash scripting with WordPress, especially with WP CLI. Here are some snippets I found useful. All the scripts assume a standard wp-config.php file with the database variables set. Getting the Database table prefix If you need … Continued

Read More..22, Jan 2016
Bootstrap, Development, Magento, WordPress,

Black Friday Deals for Web Developers

Here’s a compiled list for a lot of GREAT deals for Black Friday.  If you’re a developer, or even a designer there’s definitely something here for you! Made By Source has a great deal this black friday. You get a 8 … Continued

Read More..26, Nov 2015
Development, SSH, Systems Administration, WordPress,

Optimize all images within current directory

When trying to get that A rating with Google Page Speed or GTMetrix, one of the easiest ways to earn points is through the optimization of all the PNG and JPG images within your web root.  I tend to use … Continued

Read More..12, Oct 2015
Magento,

How to Migrate Magento Customers and Orders

When launching an existing Magento store, one of the last things you will need to do is migrate all of the current Customers and Orders from the production site, into development, prior to actually going live. If you SSH to the server, you … Continued

Read More..16, Sep 2015
Development, PHP,

Use PHP to pull Users Instagram Feed

<?php function fetch_data($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 20); $result = curl_exec($ch); curl_close($ch); return $result; } $count = 10; // the number of photos you want to fetch $access_token = “###################”; // Put your … Continued

Read More..16, Sep 2015
Linux, Systems Administration, WordPress,

Tuning and benchmarking Apache and MySQL

Have you ever found yourself needing to speed up apache or mysql?  Here’s a quick writeup on some very useful tools when you first setup Apache and MySQL.  These will help you optimize and build out the absolute best configuration … Continued

Read More..10, Sep 2015
Development, Email Marketing,

Prevent gmail from breaking width of email template.

Recently while coding out an e-blast I came across an issue where the layout rendered perfectly on desktop and mobile devices ( it was a responsive theme ) with any email client, except gmail on both iOS as well as … Continued

Read More..14, Aug 2015
PHP, Security, SSH,

Find all files touched within the last 2 weeks

If you’ve ever had to deal with a hack before, you know how frustrating it can be figuring out what files were infected.  This is a great method for finding all the PHP and JavaScript files that have been touched within … Continued

Read More..10, Jul 2015
Magento, Security, SSH,

Get a list of all installed Magento Patches

Lately there have been a lot of patches out there for Magento.  Some pretty major security vulnerabilities have come out as of late ( supee-5344 ).  If you’ve ever needed a quick way to check whether or not you’ve actually … Continued

Read More..09, Jul 2015
Development,

FIND TEXT BETWEEN TAGS – SUBLIME TEXT

Often you may want to change all text between certain tags within Sublime Text, remove all types of certain tags, or change all of one HTML Tag to another. This is very often the case in XML documents or if … Continued

Read More..29, Apr 2015
Uncategorized,

Laravel Force HTTPS

Using App::before You might be able to take advantage of the App::before() block in the app/filters.php file. Change the block to include a simple check to see if the current request is secure, and if not, redirect it. App::before(function($request) { … Continued

Read More..31, Mar 2015
Development, jQuery, WordPress, WPML,

Automatically check WPML custom field checkboxes

Today I faced a pretty daunting task, I needed to check around 2,600 rows of checkboxes across 4 different sites, each that had 3 different options. You might face this yourself within the WordPress WPML ( WordPress Multi Site) custom field … Continued

Read More..20, Feb 2015
Development,

How to skip fsck after reboot

With the recent Ghost Vulnerability out in the wild, I was tasked with patching our development servers and needed to reboot them in the middle of the night.  8 servers went down and came up within a minute, but 1 server … Continued

Read More..30, Jan 2015
Gravity Forms, PHP, Security, WordPress,

Detect and Prevent Malware in Gravity Forms File Upload with PHP ClamAV

One of the best and most widely used form building plugins for WordPress is gravity forms.  If you’ve ever needed to allow users to upload files to your site, but you want to make sure those files are not harmful, the … Continued

Read More..07, Jan 2015
Development, PHP, WordPress,

Pull YouTube Description into WordPress Content

You might find yourself needing to dynamically update your WordPress post content with the description of a YouTube video. I put together the following function to accomplish just that! function update_description_with_youtube( $post_id ) { if ( ! wp_is_post_revision( $post_id ) … Continued

Read More..11, Dec 2014
PHP, Security, SSH, WordPress,

How to find and clean up infected WordPress Files over SSH

If you’ve ever found yourself with a hacked WordPress site, one of the hardest things to do is scan your entire server and find all of the infected files.  I’ve had to do this a few times for various clients and … Continued

Read More..28, Nov 2014
PHP, WordPress,

Disable All Mail for WordPress

I did this simple hack on a private WordPress Multisite blog, to stop it sending me emails every time I created a new blog. It’s definitely overkill to stop all emails, but unfortunately I couldn’t find any hooks that let … Continued

Read More..18, Nov 2014
PHP, WordPress,

Create options pages in WordPress with Advanced Custom Fields (ACF)

I searched low and high to figure out how to create options pages in the updated version of Advanced Custom Fields (version 5 of ACF)   if(function_exists(“acf_add_options_page”)) { acf_add_options_page(); } if(function_exists(“register_options_page”)) { register_options_page(‘Various’); register_options_page(‘Header’); register_options_page(‘Footer’); } After creating the fields … Continued

Read More..29, Oct 2014
PHP, WordPress,

Get the latest Post ID in WordPress

Here’s a neat little trick that will get you the latest post ID from WordPress. <?php echo $newest_post_id = $posts[0]->ID; ?>  

Read More..29, Oct 2014
PHP, WordPress,

Dynamically Add Parameters to the end of all wp_nav_menu()

I was working on a client who’s site I was working on where I was required to capture, and hold onto an affiliate tracking variable and value throughout the entire session of a user while browsing their website.  I was able to do … Continued

Read More..28, Oct 2014
PHP, WordPress,

Force WordPress user to logout after inactivity

You can use the following snippet to force the end user to logout after a period of inactivity. function kc_cookie_expiration( $expiration, $user_id, $remember ) { return $remember ? $expiration : 600; } add_filter( ‘auth_cookie_expiration’, ‘kc_cookie_expiration’, 99, 3 ); Simply update … Continued

Read More..27, Oct 2014
PHP, WordPress,

Set WordPress image quality to high

Did you know that by default, WordPress smushes your JPG images down to 60% quality after your upload them? You can circumvent this by editing your themes functions.php file and adding the following snippet. Please note: You will sacrifice speed for … Continued

Read More..24, Oct 2014
PHP, WordPress,

How to create custom auto generated image sizes in WordPress

If you’ve ever needed to create custom image sizes for your WordPress installation, this function will come in very handy. This function relies on the WordPress add_image_size() function. For your own reference the add_image_size() function uses the following parameters: <?php add_image_size( … Continued

Read More..24, Oct 2014
PHP, Uncategorized,

Remove the ability to edit theme in WordPress admin

When developing sites for clients, sometimes you want the ability to prevent the end user from being able to edit/access the theme source code from the admin panel “Appearance -> Editor” area.  This snippet works great for just that! // Disable … Continued

Read More..24, Oct 2014
Uncategorized,

Social Media Sharing links without using a Plugin

If you ever want to include Social Media sharing links, like the ones found here on my blog, without wasting resources using some bloated plugin, you can use this code.   <div class=”facebook”> <a href=”http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>&t=<?php the_title(); ?>&p[images][0]=<?php //echo $challenge_card[sizes][large]; … Continued

Read More..23, Oct 2014
PHP, WordPress,

Require login to view WordPress site

You may want to force users to login in order to view a page within your WordPress site. You can use the following code to do that: add_action(‘template_redirect’,’giga_check_if_logged_in’); function giga_check_if_logged_in() { if(!is_user_logged_in()) //Are they logged in? If not: { // Get … Continued

Read More..23, Oct 2014
PHP, WordPress,

How to Grab first image from wordpress post content

Sometimes you might find yourself in a situation where you have pages / posts that don’t have a featured image set but you want to pull an image to use on a listings page or some other page in your WordPress … Continued

Read More..23, Oct 2014
jQuery, PHP, WordPress,

How to load jQuery in WordPress theme

When building out a custom theme, one of the first things most developers will need in their set of tools and resources to write efficient code will be jQuery.  There are a number of ways you can add jQuery into … Continued

Read More..21, Oct 2014