Archive for the ‘Development’ Category

9 January, 2014 — Development, Snippets, WordPress

Create a “Recent Posts” Module Outside of WordPress

Not all websites run on WordPress, but some websites might decide to use WordPress as their blogging choice. They decide they want to display the recent posts from the blog on the website. However the website isn’t in the WordPress core. So how do we display the recent posts on the website?

The Code

To be able to use WordPress outside of the WordPress core is simple. Just include the 

 file in your website:

// Include the wp-load from WordPress Install

// Get the last 10 posts
$recent_posts = wp_get_recent_posts(array(
    'numberposts' => 10

// Output the posts
echo '<ul>';
foreach($recent_posts as $post) {
    echo '<li><a href="', get_permalink($post['ID']), '">', $post['post_title'], '</a></li>';
echo '</ul>';

Once you have the 

 file included, the entire WordPress core is open to use!

28 December, 2013 — Development, Tech

Should Web Designers Be Able To Code?

Over Christmas I was flicking around the internet one evening and stumbled across a blog post here, and after reading it, it got me thinking about events that have happened in my life that leads me to believe that Elliot’s tweet was absolutely correct.

(an old Tweet I know but still just as relevant I think)

If someone is calling themselves a “web designer” they should not only be able to design but have the ability to visually or physically be able to work through the build process for a project’s visual aspect. Thus knowing and getting to know the limitations some designs may have before the final design is signed off by the client, making them think thats what there getting. I can’t remember how many times I have been sent a flat Photoshop (psd) file that is both complex and near impossible to build with the time allocated and the clients budget. Where the designer can’t code and therefore has no reference for the technical abilities needed to achieve the finished design and look they are after.

Web Designers – Can’t or Won’t

As in Elliot’s post there is a clear line between designers who can’t code and those who won’t code. However I think this is somewhat miss leaving in his post as he refers to “can’t” as ‘choosing not to’ – so they can but choose not too – where as I think there are designers who can’t because they don’t know how and need to be taught but are willing to learn.

What’s the options?

So the question is, should people who are web designers be able to code what they see visually? Or maybe we should be designing in the browser from the word go, after all it is 2013 (nearly 2014). Leaving photoshop for what it was built for?

I would love to hear your views from both designers and developers below.

Photo by takorii

5 November, 2013 — Development

Center a Block Element Without Knowing its Width

Centering an element may seem quite simple thinking that “text-align:center” will solve the problem. Or maybe set “width” and “margin: 0 auto”, but what happens when you need to center a block element with variable width?

W3C tells us that we can use “margin: 0 auto” to center tables so why shouldn’t we use display: table to center a fluid div:

#my-element {
  display: table;
  margin: 0 auto;

This can solve many problems and does a good job in some cases but you must be aware that “display: table” is not working when using our “beloved” Internet Explorer (IE5.5, IE 6, IE 7) so don’t count on this for main design elements (especially if this ruins your design).

I hope this was useful for you! If you have any comments or suggestions, do not hesitate to post them in the comments section.

Photo Credit: Zzpza

24 October, 2013 — Development Flagged “Contains Malware” UPDATED

Tried to access today? You might be surprised when you try to and receive the following message.

The Website Ahead Contains Malware!

It would appear that has been flagged as a website that contains malware. Its unclear yet as to if was hacked or this was a mistake?

A message displayed when trying to access via Google states the following:

What happened when Google visited this site?

Of the 1613 pages we tested on the site over the past 90 days, 4 page(s) resulted in malicious software being downloaded and installed without user consent. The last time Google visited this site was on 2013-10-24, and the last time suspicious content was found on this site was on 2013-10-23.

Malicious software includes 4 trojan(s).

Malicious software is hosted on 4 domain(s), including

3 domain(s) appear to be functioning as intermediaries for distributing malware to visitors of this site, including,

This site was hosted on 79 network(s) including AS36752 (YAHOO-SP1)AS23148 (TERREMARK)AS36444 (NEXCESS-NET).

We will have to see if manage to get this issue sorted, in the meantime try using W3 School

 UPDATE: Please see this topic on Google’s forum.

16 October, 2013 — Development

Debitoor API Helper Class

As you may know if you read my review of Debitoor a few weeks ago, I am a big fan of their service. When I first found Debitoor, they didn’t have an OpenAPI for people to use. I wanted to send data from my website right into Debitoor without the need to enter the information twice. This was when I went over to there feedback forum and requested the public API. They accepted my request and yesterday Debitoor released some exciting news.

There API is now ready to use. I jumped right into it and started developing my application. The API is a RESTful API meaning it responsed to JSON and HTTPS requests. I decided to write a quick PHP helper class to allow quick sending and receiving of data to the Debitoor API.

You can download version 1.0 of the helper class here!

This is not part of Debitoor and is code written by myself. If you wish to have something added or have any questions please comment below.

UPDATE: Please also find this on GitHub

15 September, 2013 — Development, Snippets, WordPress

Display A Message On Older Posts

When blog posts get old, sometimes the information in them is not as accurate as they were at the time of writing. This can be misleading and can cause confusion to the reader.

This simple bit of code when either placed in your themes funcions.php file or a functionality plugin will display a message at the top of any posts that are older than 1 year. You can customise the message in the code below and add some styles to your style.css file. Once done upload your file WordPress will automatically take care of the rest.

// display a message on older posts
function tb_older_post_message () {
    $posted = get_the_time('U');
    $current = current_time('timestamp');
    //Convert difference in seconds to days
    $diffTime = ($current - $posted) / (60*60*24);
    if($diffTime > 365){
        echo '<div class=older-post-message>' . __('This post was written more than a year ago and <em>might</em> not be entirely accurate anymore.', 'wptips') . '</div><br />';