Blog

My First WordPress Plugin

WordPress is the largest blogging platform available on the internet today; this is my first plugins for you. nd with the official release of version three just around the corner, it’s only going to get bigger. As such, over the next few self-contained tuts, we’re going to learn the ins and outs of WordPress plugin development, starting with the creation of our first simple plugin, “Simple Optimization.” Step 0 Before we Begin This tutorial is going to assume that you […]

wordpress shows post content from database

wordpress shows post content from database query_posts command allows you to query the WordPress wp_posts database and retrieve post objects (e.g. posts, pages, attachments) based on their attributes. get_posts is similar to query_posts and is also used to query the wp_posts database. You will note however, that the argument list it uses is slightly different compared toquery_posts, therefore make sure to refer to the WordPress codex to ensure that you are using the right argument names for each of these […]

Returning a list of array keys in MongoDB

Here’s how I return a list of keys from an associative array (i.e. an embedded document) without also returning their value. The data structure I have is shown below. It’s made up of an associative array [friends], which contains a set of keys (Twitter usernames) and values (details about the user). My aim was to return a list of the Twitter usernames, without all of the details associated to them which – in some cases – could be quite a […]

Latency between Amazon Web Services Regions

Recently I’ve had to spend quite a bit of time working out which of the 5 Amazon regions is best positioned for various services I’ve been setting up. As part of this I measured the latency between each of the Amazon regions. For anyone who’s interested – here are the results. Note: For ease of reading I’ve including all measurements under each region. Half of the data will therefore be duplicated as I’ve assumed (rightly or wrongly) that EU-West -> […]

Adding my “3rd party” module into /vendor in Zend Framework

This wasn’t initially obvious to me, but when creating a generic module to use across multiple Zend Framework 2 projects (thus putting it in /vendor) you can include a Module.php file in the root of the module’s directory to make registering the namespace with Zend’s StandardAutoloader simple. (I had assumed this was just how it worked under the /module directory). So for example – I have a module with the namespace ‘Nas’, so I store it under: /zf2/vendor/Nas And then […]

Facebook PHP SDK Zend Framework 2

In ZF1 I would generally include 3rd party API wrappers (Facebook, MailChimp, Google, etc) in Bootstrap.php using something like: 1 2 3 4 5 6 7 8 9 protected function _initIncludes(){ include_once( ‘MobileDetect/Mobile-Detect-2.php’ ); include_once( ‘Facebook/php-sdk-v3.1.1-27/src/facebook.php’ ); include_once( ‘Google/google-api-php-client-0.5.0/src/apiClient.php’ ); include_once( ‘MailChimp/MCAPI-1.3.class.php’ ); } //_initIncludes Facebook PHP SDK Zend Framework 2 However there isn’t really anywhere appropriate to ‘include’ things this way in ZF2. Ideally we want to include the 3rd party class in the (/all) module(s) that actually use […]

Youtube

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam semper leo eget sapien ultrices vitae facilisis massa dictum. Fusce eu purus a urna accumsan luctus. Nullam sit amet nisi non ante ultrices egestas. Proin erat nulla, congue adipiscing accumsan id, sollicitudin eget dolor. Vestibulum ipsum urna, consequat vel cursus ut, scelerisque vel nisl. Suspendisse molestie facilisis dui, et rutrum enim fermentum id. Curabitur tincidunt tellus sed risus vulputate fringilla. Mauris luctus posuere odio, quis viverra purus consequat ac. Aliquam luctus […]

Vimeo

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam semper leo eget sapien ultrices vitae facilisis massa dictum. Fusce eu purus a urna accumsan luctus. Nullam sit amet nisi non ante ultrices egestas. Proin erat nulla, congue adipiscing accumsan id, sollicitudin eget dolor. Vestibulum ipsum urna, consequat vel cursus ut, scelerisque vel nisl. Suspendisse molestie facilisis dui, et rutrum enim fermentum id. Curabitur tincidunt tellus sed risus vulputate fringilla. Mauris luctus posuere odio, quis viverra purus consequat ac. Aliquam luctus […]

This is a link

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus blandit porta tellus non vulputate. Nam in nulla ut augue bibendum aliquet eget eu velit. Suspendisse non ligula sit amet felis volutpat hendrerit eu ac odio. Etiam elementum dui vel libero laoreet sagittis. Vestibulum ac elit orci, et cursus mauris. Nulla vehicula lorem odio. Mauris vel mauris justo, sed adipiscing neque. Nam ipsum dolor, congue ac vestibulum eget, luctus nec ipsum