A selection of 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 more

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 more

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 more

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 more

Looking to start a project? Let’s work together. Email info@adamboother.com.