Blog

A selection of useful solutions to web development dilemmas.

Automatically post to a Facebook page using the Facebook PHP API (v5)

The Facebook API lets you post to pages you administrate. In the article below I’m going to explain how I did this, using version 5 of the SDK for PHP. The brief was to write a script which automatically posted any newly added WordPress custom posts to my clients company Facebook page. So here’s how it went: 1. Create a Facebook 'App': Firstly you need to create a Facebook App, which is required...

Read full post

How to use WordPress functions in a non-WordPress custom PHP file

I recently came across a scenario where I wanted to make use of some of the many WordPress functions available, but in a non-WordPress custom PHP file. I was building a feature which automatically sends any newly added WordPress ‘property’ custom posts to my clients Facebook page, using the Facebook PHP SDK. To achieve this, I wanted to loop through the ‘property’ custom posts using WP_Query and post each newly added property to the Facebook...

Read full post

How to install Git on a GoDaddy shared hosting server

I have a Linux shared hosting account with GoDaddy, which I use to host sites for a selection of my customers. A few months back I decided I needed to get up to speed and use version control to manage these sites. Working on the sites locally and pushing any amended files up to my server using FTP was not a great workflow. So, I decided Git was the way forward. After hours of...

Read full post

Animated scroll to an element using jQuery

As more sites go responsive and ‘one pager’, it’s often you see a smooth animated scroll effect when you click a link or element on a site. It just looks nicer than an anchor, which promptly jumps you down/up the page…eughh.Using just a few lines of jQuery can achieve this nice effect. Here’s how it goes. Firstly, we create a function to handle this effect: function scrollToElement(selector, time, verticalOffset) { var $time =...

Read full post

How to change the domain/URL for your WordPress site

It is possible to programatically change the URL for your WordPress site. This comes in handy if you need to migrate your WordPress site to a different location, or if you want to work on your WordPress site on a local environment. To do so, just paste the following two lines into your wp-config.php file: define('WP_HOME', 'http://www.mydomain.com'); define('WP_SITEURL','http://www.mydomain.com'); You can copy these two lines anywhere in the file above the comment which reads: /*...

Read full post

How to remove widgets from the WordPress Dashboard

Have you ever wanted to tidy up the WordPress dashboard? Perhaps you’re building a site for a client who may get confused by all the widgets that appear by default. You can indeed hide these for your user account when you log in to WordPress (under the ‘screen options’ section on the dashboard) but the remove_meta_box() function allows you to remove these widgets from WordPress altogether. Here’s an example of the default WordPress dashboard: As you...

Read full post