Installing Laravel

Installing Laravel

Laravel is a PHP framework so we need to start with a L(W)AMP server of some sort. We recommend PHP 7 but from PHP 5.6 will do. Laravel is easiest to install with Composer. Once Composer is installed according to their instructions, we can use it to install Laravel. There are different methods of installing Laravel but I prefer installing it as a global package on the system. To do this, on the command line type: composer global require “laravel/installer”…

Read More Read More

WordPress wp_remote_get

WordPress wp_remote_get

I was recently working on a project which involved using WordPress cron for some automated tasks. Although the function wrapping the call to the WordPress even scheduler reported being called, the ‘work’ was not being done (in this case retrieving data from a remote server). This was particularly strange because if I ran the functionality manually it worked. Note: I inherited this system from another developer so any references to code duplication are not of my doing! Upon closer investigation…

Read More Read More

Creating Separate Categories for Learndash

Creating Separate Categories for Learndash

I was recently tasked with assisting in setting up a website which needed, amongst other things a Learner Management System. One of the go to LMS for WordPress is the Learndash plugin. I installed Learndash and then proceeded to set up a test course. Now, the idea with this website (which I believe is common to many sites) is that there would be both a courses section as well as a blog. The blog would have categories like “Getting Started”,…

Read More Read More

Creating a Simple .htaccess redirect

Creating a Simple .htaccess redirect

RedirectMatch uses a regular expression that is matched against the URL path. And your regular expression /contact.php just means any URL path that contains /contact.php but not just any URL path that is exactly /contact.php. So use the anchors for the start and end of the string (^ and $): RedirectMatch 301 ^/contact\.php$ /contact-us.php redirect 301 /contact.php /contact-us.php

Spam Trap for Contact Form 7

Spam Trap for Contact Form 7

This plugin adds spam checks to catch contact form 7 spam. It does so in the background without annoying your legitimate users with captchas. It adds a hidden field to the your contact form 7 form and then checks when a contact form 7 is submitted for that field. If its not present, or its filled in, then we can be sure that it was a bot of some sort. It also adds the ability to check for links in…

Read More Read More

PHP Namespaces

PHP Namespaces

PHP namespaces allow you to namespace your functions! Ok, so I know that’s circular reasoning. Let’s see what that means. We’re all familiar with the way that files and folders work on our PCs. If you have two files with the same name, then they cannot exist in the same folder. So, if I have a file called notes.txt with all my work related notes, then I can’t also have a file called notes.txt with all my personal related notes…

Read More Read More

PHP: Create an installer with composer

PHP: Create an installer with composer

Composer is the current most popular package management system for PHP. Composer is used to manage package dependencies and chances are good that you’ve used it to install software before. In this article we’ll look at creating your own installer with composer for your PHP projects. Using PHP’s dependency manager, Composer you list your project’s dependencies in a composer.json file and, with a few simple commands, Composer will automatically download your project’s dependencies and set up autoloading. You can think…

Read More Read More

How to fix WordPress after changing table prefix

How to fix WordPress after changing table prefix

In this article find out how to fix WordPress after changing the table prefix. In your wordpress wp-config.php file you have a $table_prefix variable, which by default is set to “wp_”. If you need to change that on an existing wordpress site then you’re in for a bit of a battle. On a site I’m working with we needed to change the table prefix when moving the site to a new server. Changing the table prefix meant that we weren’t…

Read More Read More