Browsed by
Category: Technology

Story Terrace: Create your Family Biography to Keep Forever

Story Terrace: Create your Family Biography to Keep Forever

Unfortunately all of my grandparents have now passed away; and for each one there are many lost memories. There are stories that we can remember small details of, and then there are meaningful events that we don’t even know we have lost.

Over time, the stories we do have fade. I remember a bit of my grandpa Harry’s life, I remember distinctly some lessons on how to deal with the monotony of school but there are so many things I wish I knew. My Nana couldn’t quite find the right way to get the stories down and I didn’t know that this would be important to me as I grew older.

Nana and me!
Nana and me!
Grandad and me!
Grandad and me!

It’s frankly difficult to capture those memories, yet objects and letters are so meaningful and valuable to look back on. I know some of my school essays are mesmerising to re-read but unfortunately I have thrown a lot of it away – along with it many irrecoverable memories of my own childhood.

Rutger Bruining noticed a few years ago that freelance writers were more readily available and he also saw the world of bespoke printing on the rise. Putting two and two together, he came up with a company called Story Terrace; the main concept to handle the end-to-end process of finding the correct writer, doing the face-to-face interviews, getting an outline of a life story, drafting it back and forth and then the editing, typesetting and printing.

It sounds complicated but he found a way to make it easy!

story-terrace-logo

I wish something like this existed or I knew about it at the time of trying to get my Nana’s stories down, she had a fascinating life. Nana worked in the Royal Air Force and was stationed in St. John’s College Cambridge, then she got married to a Scot (George) and had kids, sadly losing her husband to a heart problem which would be so treatable now, and bringing up 2 daughters by herself, somehow keeping the house, working as a driving instructress and sending my Mum to boarding school…the details mostly lost.

I was approached by Rutger almost 2 years ago now through a friend to just have a chat. I was looking to get my blog of my bike ride made into a book and he was the man to do it! He wanted to also ask a favour of fixing his website, and after several months of helping out and eventually becoming free from another project, I joined Story Terrace full time as their CTO.

We have sold over 150 packages in both the UK and the Netherlands. They have ranged from people who have barely left the town they were born in, to immigrant stories, to entrepreneurs and their business growth, to finally opening up about an abusive upbringing. We have also managed to tell some stories from people with terminal diseases who have since passed. The meaning to the families and friends of getting these stories down is indescribable.

rutger-and-his-mum
Rutger and a book about his mother(pictured)’s father

The challenge we have is getting the word out there that you can do this, and also convincing people that now is as good a time as ever to get these memories down, you can always come back to it in ten years and add a few new chapters.

I know I would like to read about my family and where we came from, and I am sure my children and grandchildren would like to learn a bit more about me at some point!

So please share this with others, and tell people about it – maybe even consider buying a package as a gift too. (storyterrace.com)

WordPress Debugging: Optimising and making slow instances run faster

WordPress Debugging: Optimising and making slow instances run faster

I have a client whose WordPress site was compromised in the past and I managed to make some huge improvements by some use of a simple plugin – P3 Profiler.

It was very easy to install and setup (I had to add a profiles directory to the wp-content/uploads directory and also make sure that the Media links directory was correct – I was testing on a local version so needed to update this).

After running the scan I could see that there were clearly some slow plugins working – mainly a re-captcha plugin. I decided it was probably better to have the site running faster than have this in place, and I could always look for another solution further down the line if there was too much spam on the forms.

I also played around with a lot of the theme’s settings. In my case “Brooklyn” that had a progress bar load on every page which simply wasn’t needed and slowed things down. Removing these slow unneeded plugins and updating the theme options makes the site run a lot quicker.

We also had issues with a virus that had got into the site. The best way to get rid of it was to install and Anti-Malware plugin (Anti-Malware from GOTMLS.NET) and run a scan to simply check for compromised files and remove them automatically or manually.

I’m learning a lot about how to keep WordPress clean and fast, and these tips should help you too!

Xbox One: Review – Don’t waste your money!

Xbox One: Review – Don’t waste your money!

I decided to splash out and get the new Xbox One with the intention of playing Halo: Master Chief Collection to re-live part of my childhood. The console has been out for well over a year now, but I didn’t see the need to get this newer console since my Xbox 360 does pretty much everything this new box does, and there are not (m)any games that you can only get on the One. This new Halo managed to convince me.

Once I finally got the console setup and spent hours and hours downloading the new Halo game to the console from the disc, I launched into hours and days of struggling to find things that work on the console, and in this shiny new Halo game.

Firstly, for a next generation console that has been out for over a year, the graphics don’t look great and the interface is slow and unintuitive (maybe that’s just Windows 8 in general). It gave me a bland black background to start with and the user experience is poor when trying to load anything (e.g. settings, friends list, party – they also removed some simple features like putting voice output to the tv so people in your room can hear what your online friends are saying).

Once I finally managed to get into the game (after several hours of waiting) I found that I couldn’t play online just yet (not even campaign co-op); I had to play solo Halo 1 campaign until the full game finally downloaded. The solo campaign was good fun but I wanted to experience it with friends! My hopes were that this new console, together with my annual subscription for Xbox Live, would be the best experience yet, but it was already falling short.

After literally hours of waiting for stuff to download to the box itself, I could supposedly play multiplayer to enjoy abuse from and to ADHD American kids who are clearly high on sugar. Alas, the game wouldn’t let me join my friends, eventually we worked out a hack to get us in the same game (not by use of the integrated Xbox friends list that takes a while to load up, but the in-game one that seems to work inconsistently). We launched matchmaking and got nothing for ages. We backed out to try again, nothing. We all restarted our boxes and somehow eventually got a game, only to find the 5v5 playlist not only didn’t have the supposed limit of 10 players, but also somehow managed to make it an uneven 5 vs 6!

This experience has continued for weeks now and everyone I speak to is frustrated by it.

So, I have given up with Halo. Supposedly 343 Industries (who make it) aren’t going to fix it anytime soon as they are focussing on Halo 5 (the beta of which seems to need a fair bit of work too – e.g. menu issues, weapon balancing, not being able to run whilst holding the score up etc…).

I decided to try the free game I got with the Kinect (Dance Central Spotlight); which seems to have only downloaded a trial version…I didn’t even want it, but hey, if you are going to give it to me as a freebie, don’t just give me a trial – especially when I just spent more than £400 on this whole thing!

This was topped off when over the christmas period, there was a supposed hack to the Xbox Live servers – meaning that we couldn’t even get online in any sense. But, before and after this supposed hack, I have had endless problems. I appreciate that there are security issues in the world, but this is Microsoft and a console that is supposed to be at the cutting edge – especially as it has had over a year to get rid of these teething problems.

I am extremely disappointed with the whole thing and will probably take it back for a refund this week.

The public has come to expect an incredible user experience now – fast and responsive – probably thanks to Apple. We do care about graphics, but it comes secondary to functionality; as an example, look at Minecraft – a huge success built on terrible graphics, but fantastically simple rules that work and provide a decent experience!

Update March 2014

Update March 2014

I thought I would give an update on my blog as it has been a while since I did so!

A major project that I have been working on for almost 6 months now is about to go live. I am looking forward to releasing it next week and showing the world what me and (now) a team of developers have created.

Recently I also managed to get a bit of spare time to start developing a side project in php. The main goals of this are really to get back into programming as I have taken some time away from that side of Software Development for a while. I thought it would be a nice time to get into some of the UX aspects of projects by playing around with ajax and javascript some more. I find it really rewarding when you can show something visual, even if the back-end parts take a lot longer to plan and develop and are actually, personally more satisfying to complete.

This side-project is coming together slowly as I dedicate more and more time to it. I look forward to releasing it when it is presentable, but it is a database tool that I would find very useful at least, and hope that many more would do so too.

I have another side project that I really want to complete, but find myself not having nearly enough time, patience etc… to actually get anywhere with it. That is to edit down a video from my 25 day cycle across Europe that ended just over 5 months ago! There is a lot of footage which I have whittled down to about 3 hours, but there is a lot more that needs to be cut, let alone the masses of editing that needs to be done before I can release it. I am hoping to dedicate 5 hours on it a week in order to chip away at it in a structured fashion, rather than attacking it randomly as I have been doing.

Otherwise, there are grand plans for another iPhone game in the future. The recent success of Flappy Bird and 2048 are really inspiring to see. Not to mention the WhatsApp acquisition by Facebook. On top of all this, there may be another project to manage that might get funding thanks to a friend’s application to some grants!

All very exciting, not to mention the “Ride for the Living” bike ride that I am helping to organise in June from Auschwitz to the JCC in Krakow.

Low Latency/Input Lag HDTV for Gaming

Low Latency/Input Lag HDTV for Gaming

Recently I went through the overwhelmingly difficult task of buying a new HDTV. Being an keen gamer (mostly Xbox 360 FPS games) I wanted to make sure that I got one good for gaming.

My requirements for the TV:
Needs to be full HD (1080p) – which almost every modern TV has these days
Needs to have a low input lag – to make gaming responsive

I do not really care about 3D TV features (there isn’t much shown in 3D that is worth watching just yet – most people who have 3D either don’t use it, or find that it is underwhelming – having said that, I was very impressed with the latest Samsung’s 3D – but still there is little content); I also don’t care about the apps that are on the TV. For watching movies and TV I use a variety of online resources and can easily connect my laptop to the screen. (Samsung’s app system seems to be more advanced from Sony’s though).

A few years ago, I won a Samsung 50″ Plasma in a UK Halo tournament. Excited to get it home and play on it, I found I felt out of control of the game. I couldn’t understand it and it was hard to explain, but it felt sluggish. After a small amount of research I found input lag from the Xbox to the TV was probably the issue. This means that when you move or shoot with the controller, it take a small amount of time (tens of milliseconds) for the screen to show this.

I grew up on CRTs which have little to zero input lag and have been used to it my whole life.

As an example: imagine aiming to the right and then shooting a target. Once you move on the controller, the screen wouldn’t update quick enough, so my brain would tell me I needed to move, then it would show up on the screen and I would see that I was in the correct place, then I would shoot on the controller, however that wouldn’t show up for a small while, by which time my reticule had moved passed the target because of the over-compensation for the slow response and I would end up missing.

I ended up selling the TV and bought a new computer with the money! I stayed on my CRT for as long as I could.

This time I was determined to not have the same problem. I conducted a lot of research online, but noted there seemed to be not much on display lag. The web also suggested that input lag was so insignificant that gamers would not have a problem with all modern TVs. Still weary, I expressed my concern to the sales guy (who shall remain nameless) in an electronics store. He expressed that TVs do not publish screen lag anymore as “it is just a war with numbers”.

Convinced by his expertise because he works in a TV store, we discussed the different options. Samsung, to my knowledge, have the same components as Sony TVs which are known to be expensive. According to a lot of people, you are simply paying for the brand when it comes to Sony, and so you should stay away. THIS IS NOT TRUE!

I proceeded to purchase the latest Samsung, with 3D included. The idea would be that with 3D there is a faster processor, so there should be less lag – right?! WRONG!

I don't know how we fit it in, but we did!
I don’t know how we fit it in, but we did!

I took the TV home and felt the same problems. Even using different inputs and settings there was still an overwhelming problem (PC mode is meant to be the quickest – ahead of Game mode – but both did nothing noticeable). Recently, I have been playing on a Dell 24″ monitor with next to no lag and so this TV was unbearable. A painful repackaging occurred and I took it back; along with my Xbox 360 to the store to test there.

I spent a lot of time looking at input lag tables online (a few of which are linked here):
http://www.displaylag.com/display-database/
http://www.hdtvtest.co.uk/news/input-lag
http://reviews.cnet.com/8301-33199_7-57587317-221/game-mode-on-cnet-tests-tvs-for-input-lag/

The lists are hard to compare as they use different methods to test. I spent a lot of time checking that the lists were consistent with each other (at least in terms of where each TV came relative to the others). The lists are by no means complete, and there are very few models that are tested on multiple lists to confirm that they are consistent with each other – but in most places they seemed to agree and it was good enough for me to get an idea of what was good.

The conclusion from these lists was that Sony KDL models tended to be at the top of them – fairly consistently. My decision was made to try this Sony Bravia system to see if it made a difference. Several reviews suggested that the gaming mode on Sony ripped out a lot of the processing and so they could respond quicker than other TVs. Albeit losing a bit of quality – something I don’t really mind – as long as I don’t die on every encounter because of my poor setup.

I knew that Sony was more expensive in general but continued to compare Sony models within my price range (£500-600). Heading down to the store with my Xbox was a fun experience. I tried 4 or 5 TVs, most of which were Sony Bravia. We played with the settings in store to see if anything felt better.

I discovered a nice trick to test the lag, even if not with a calibrated piece of equipment or particularly accurate and measurable. If you take the audio output from the Xbox directly (for one speaker) to a portable speaker (that an electronics store has plenty of) and the other audio line goes to the TV, you can actually hear the difference in the sound. Even something as simple as moving through a menu or shooting a gun once in game, if there is just one click. You will hear it direct from the xbox through the speaker, and also through the TV after it does all the video processing and syncs them back up. The delay is easily audible and it sounds as if two shots are fired instead of one.

Testing my Xbox 360 in store!
Testing my Xbox 360 in store!

I tested the latest W805 from 2014 which seemed to have a significant difference between the sounds. This model has 3D with it, so we tested the W705 which is marginally cheaper but doesn’t have the 3D associated. I didn’t check with any detailed calibration, but it sounded better than the 805 and felt a little better – which agrees with one of the tables of lag times.

Finally I was suggested to try last years model (a W65) which seemed (although maybe I was getting tired) to be the best out of them all, with only a very small delay between the sounds. It turns out that this older TV has no 3D and is actually cheaper than all of the others as well as cheaper than the original Samsung I bought.

Conclusion
Sony Bravia with game mode seems to be the best range of HDTVs for gaming. These are the best I found, and although not perfect, the best I can see on the market. The best solution is to use a monitor, but they don’t normally go that big and, since we were getting a new TV for TV anyway, it seemed sensible to get this one.

Also, don’t believe everything you are told by the sales guy, they are just trying to get their commission.

3D might mean a faster processor, but it doesn’t mean less input lag.

See what is out there and do your research on them before doing an impulse buy. Make sure you check it out in store and perhaps sit on your decision for a few days at least.

Don’t be scared to take your games console into the shop and try it out – the sales staff will actually enjoy it as it gives them something different to do! I would suggest that they might know about this stuff, but my experience has been that no-one really knows about it!

Improving the Correct Things: Amdahl’s Law

Improving the Correct Things: Amdahl’s Law

I see a lot of people in the world trying to optimise the wrong things.

During one of the undergraduate Computer Science courses at Cambridge (about parallelisation of processes) we learnt about Amdahl’s law. Essentially, it helps you improve the efficiency of a project by identifying the parts that can cause the best speedup.

The law demonstrates that improving the most time consuming tasks by a little can cause more benefit than improving smaller tasks a lot. Something that can be quite obvious when you think about it, but people rarely consider when trying to complete a project.

This is probably better understood with a real life example:

A group of my friends were organising a dinner at a nice pub offering a deal on a burger and chips for £7.50 instead of the £10.50 it would normally cost. One friend said he didn’t want to go because it was too expensive. I then suggested McDonald’s instead, but he retorted saying that it was too expensive. Burger King was where he wanted to go, apparently for the price.

It is probably about £4 for a meal deal from Burger King and around the same price at McDonald’s, if not cheaper.

Obviously I have no issue with people wanting to save money. In actual fact I think more people should think of the long term and save more than they do – but that is a separate topic.

My problem is that this particular person would then go to the bar and spend A LOT on alcohol. He would do this regularly – I mean about £20-£25 a night in the student bar. If he just took one night off the drinking he would easily be able to come to the much nicer pub with his friends (only an extra £3.50! – but of course we haven’t talked about the return that he gets from drinking which perhaps is part of the issue).

(non-geeks look away) Amdahl’s law states that the maximum speedup of a computation is limited by the amount of the algorithm that must be serial. That is to say, if you must put some time into one bit, then it will limit how quickly you could get the whole task done.

The law extends to the summation of all of the sub-task’s time, indicating that an improvement is best applied to the most time consuming task.

Amdahl's Law Speedup
B is the fraction of the algorithm that is strictly serial.
n is the number of threads
T(n) is the time it takes to complete with n threads.

I extend this to real life with respect to many things. For example, getting 10% off your rent for a year saves you a lot more money than getting 50% off one meal. It might be easier to haggle a 10% discount from your landlord than searching for vouchers online for hours to get 50% off a meal in a restaurant.

Assume that a task has two independent parts, A and B. B takes roughly 25% of the time of the whole computation. By working very hard, one may be able to make this part 5 times faster, but this only reduces the time for the whole computation by a little. In contrast, one may need to perform less work to make part A be twice as fast. This will make the computation much faster than by optimizing part B, even though B's speed-up is greater by ratio, (5× versus 2×).
Assume that a task has two independent parts, A and B. B takes roughly 25% of the time of the whole computation. By working very hard, one may be able to make this part 5 times faster, but this only reduces the time for the whole computation by a little. In contrast, one may need to perform less work to make part A be twice as fast. This will make the computation much faster than by optimizing part B, even though B’s speed-up is greater by ratio, (5× versus 2×).

It actually quite upsets me when people are inconsistent in this respect. This law can help to explain my frustration where people focus too much on trying to make the small things more efficient, but forget about the bigger picture.

There are many examples I can think of when people spend a lot of money during a night out: on food, drink and cigarettes, but will not share a cab home for £5 each; instead taking the tube for £2. The £3 saving being very little in comparison to the money they spent earlier in the evening.

Another clear example is when people go on vacation, usually spending in the region of £500-£1000 for a week’s holiday; then insisting on spending hours haggling at a street market over 20 pence for a piece of tourist memorabilia. I enjoy haggling as much as anyone else, but I wouldn’t walk away from a cheap gift because a market seller wouldn’t move on 20 pence which means a lot to them, but not as much to me. I certainly wouldn’t be upset if the guy didn’t actually sell me the item for the price I wanted, considering the amount I just paid for the whole trip!

Bottom line: don’t worry about trying to improve the smaller things by a lot – they won’t give you anywhere near as good a result as improving the bigger things by a little.

New Project Ideas: Apps and Websites

New Project Ideas: Apps and Websites

A lot of people ask me for advice about their entrepreneurial product ideas. They usually get hold of me from personal recommendations as I know how to build mobile applications/websites, which almost every new idea is (or at least needs) these days, and I have a commercial knowledge of technology.

Unfortunately, these propositions tend to not be that well thought out, and sometimes even lack a business case. I thought I would post a few common queries people often ask me about to help people formulate their business ideas more clearly.

The most common first question is “how much does an app cost?”

Like the answer to most things – it depends. Angry Birds cost a lot more to make than Jump Duck. I need more details about what the app will include. A bullet-point list of features is a good start and then we can go into discussing how you think these should work too. Also whether you have a good budget for this. You can get things built cheaply in eastern Europe or Asia, but it won’t be as good technically as if you were to build it in London with a major development agency and you will not encounter problems with language barriers.

Should you need it, then I can definitely give advice on how I think your application should work. Having completed a few software projects now, and having a good understanding of a lot of the products in the market, I can help to steer your idea in to what I believe to be the right direction. But always remember that things evolve over time. Design decisions might make sense now but in the future things might need to be different; remember to factor in this extensibility which is a lot easier to do if you build the technology well in the first place. Seeking advice from multiple sources helps you to get to something better as you weigh up the strengths and weaknesses of each design decision.

A few people have asked me to sign NDAs (non-disclosure agreements), which means I agree not to tell anyone about the idea or steal it for my own use. I don’t mind signing these but I don’t actually know how valuable they are.

Some great advice I was given at the Cambridge University Entrepreneurs Society was to share your ideas. It will make you get rid of the bad ones, evolve the better ones and nurture the great ones. People are unlikely to steal your ideas. We are all too busy with our own lives. In general, the population aren’t just sitting there waiting for new ideas to come in to implement them before you have a chance.

Other people aren’t going to make your dream become a reality for them; they are much more likely to work with you. Especially if you are passionate about it – that is what actually makes ideas become success. Drive.

A common issue is that the inventor is married to their idea; they think any changes would cause a complete failure in their objective. You need to remember that Rome wasn’t built in a day. The most successful people make the biggest mistakes along the way. They have to. No one is perfect. Have some self-doubt – it’s good for you!

Ideas tend to come from someone wanting something, but not having it in their life, followed by thinking “other people must be in a similar position” so let’s solve their problems and make a load of money in the process like those guys we read about! Suddenly the dream of being a millionaire destroys all hope of humbleness, which is not good.

(If you watch the UK Apprentice, Neil, one of the strongest candidates, was fired in the final interview round because he wouldn’t take into account the feedback given by several experienced business men!)

Research. There is a common issue whereby people just haven’t Google’d their own idea thoroughly enough. They haven’t searched to solve their problem – which is really what they wanted in the first place. Sometimes I spend 30 seconds searching and find a complete solution to their original problem.

Be realistic. People believe that technology can solve all of the problems in the universe for them all in one go. Thinking that there is a black box somewhere that is really easy to build that “surely can just do everything“.

No.

Technology is limited to logical building blocks. Yes some statistics can be thrown in there but remember that the best things in life tend to be the simplest. Also complicated systems cost a LOT of money; so if your idea is new, KISS (keep it simple, stupid).

My job is developing ideas for people (well companies usually), and giving them specific advice on the technical aspects of their projects. The clients who matter (i.e. the one’s that pay) tend to know exactly what they want to achieve, with a solid business case for it. There might be unknowns about how the finer details will work but there is this drive of wanting to solve the problem for people.

Making a success of anything takes a serious amount of time and effort. Remember to factor this in when committing to a project. It takes time – like everything worth doing – and it isn’t easy!

And we haven’t even talked about marketing, but one step at a time, right?!

Creating a WordPress Theme from Scratch: Dynamic CSS3

Creating a WordPress Theme from Scratch: Dynamic CSS3

CSS3 and HTML (5) comes along with a great tool to give your pages a different look depending on different features of the client.

Differently sized pages can have different CSS styles without having to do anything fancy. In fact most modern browsers on a desktop (Firefox, Chrome, Safari) all cause a re-evaluation of the screen size when it is changed. This means the user always get a nice looking site without any unnecessary scrolling regardless of device or screen size:

<link rel=”stylesheet” href=”small-style.css” type=”text/css” media=”screen and (max-width:480px)”>
<link rel=”stylesheet” href=”style.css” type=”text/css” media=”screen and (min-width: 481px) and (max-width: 1024px)”>
<link rel=”stylesheet” href=”large-style.css” type=”text/css” media=”screen and (min-width: 1025px)”>

Suddenly we have three different CSS files that can feed the page: resize divs, change the font size or even hide entire sections.

Some websites take you off to a completely different subdomain of their site (e.g. m.mywebsite.com).

This means that you have to maintain a completely separate subdomain. Analytically I don’t see any benefit really – you still get the stats from your Google Analytics of user agents and hence how many people are accessing the site on their mobile.

In terms of adverts, there will be no different as to which system is used really.

So assuming that you want to show the same content to your users regardless of their device, this responsive method is definitely more useful.

Alternatively you can use just one CSS file and include:

@media screen and (max-width: 480px) {
/* SMALL SCREENS */
.menu{
display:none;
}

.mobile-menu{
display:inline;
}
}

/* NORMAL SCREENS */
.menu-title{
display:inline;
font-size:24px;
}

.mobile-menu{
display:none;
}

@media screen and (min-width: 1025px) {
/* LARGE SCREENS */
.menu-title {
display: inline;
font-size:32px;
}

.mobile-menu{
display:none;
}
}

This is just the surface of how the dynamic web pages work and there are some great frameworks out there that you should investigate to help you with your design: e.g. normalizemodernizr

Creating a WordPress Theme from Scratch: Adding Menus

Creating a WordPress Theme from Scratch: Adding Menus

As discussed in previous post, functions.php is automatically included in the processing of a theme. This is therefore the best place to add default settings that you want to a theme, as well as helper functions.

To make sure that a function is called on the initialisation of a theme you should use the following in the functions.php file:

function add_menus(){
// Do Stuff Here
}
add_action( ‘init’, ‘add_menus’ );

In order to register the menus for your theme you need to use: register_nav_menus with an array of ‘slugs’=>’descriptions’:

register_nav_menus(
array(
‘main_nav’ => ‘The Main Menu’,
‘footer_nav’ => ‘The Footer Menu’,
)
);

This will do two things.

1) It will add an ability to edit menus on the theme once activated:

Adding Theme Settings

 

It will also add all the menus that you have specified to the list of possible menus that you can use:
Menus of a Theme

 

Now to actually display the appropriate menu you just need to call wp_nav_menu(‘slug’).

So our example would be wp_nav_menu(‘main_nav’); or wp_nav_menu(‘footer_nav’);

This will print out whatever menu you have in those drop downs above.

However if one isn’t selected it seems to still show the menu with Home and About. So I created a wrapper in my functions.php as so:

function get_menu($menu){
$locations = get_nav_menu_locations();
if ($locations[$menu]){
wp_nav_menu(array(‘theme_location’=>$menu));
}
}

Now I simply call get_menu(‘main_nav’); and it will either show nothing if the menu is blank or it will be the actual menu selected.

That is it for menus for now. Remember to check how WordPress outputs the menus and change the CSS to suit how you want it to. (e.g. by default it uses menu-top-menu as the class). Or you can use a custom class  when calling wp_nav_menu():

wp_nav_menu( array( 'theme_location' => 'extra-menu', 'container_class' => 'my_extra_menu_class' ) );
Creating a WordPress Theme from Scratch: Structure of a Theme

Creating a WordPress Theme from Scratch: Structure of a Theme

If you have been following my post to setup the site from scratch you will just have three files in your theme directory:

Files in Theme Directory

 

This post is simply to tell you how WordPress processes things nicely technically so you can decide how best to use it for your design. Actually working out what your website is going to look like is a completely different task.

There are some built in files that WordPress expects that are immediately useful:

  • header.php
  • footer.php
  • functions.php

WordPress uses get_header() and get_footer() to grab the contents of these files.

functions.php is automatically included which is useful for setting up helper functions, creating menus for a theme or changing other variables within WordPress.

Similarly it is worth keeping in mind that the following pages can be used to define the outline for how the appropriate pages will look (however for an initial theme it probably isn’t worth editing these):

  • archive.php
  • category.php
  • tag.php
  • 404.php

Without any of these files, WordPress will simply look at your index.php and work out what to do from that.

So for now it is probably just inputting some values into the header and footer to get the structure of your site sorted.

index.php:

<?php
get_header();
get_footer();
?>

header.php:

HEADER

footer.php:

FOOTER

Going to the dashboard and now activating your new theme will simply show HEADERFOOTER on every page that is valid.

Cool. Now you can change those files to contain sensible contents (e.g. html, head and body tags!).

I also noticed that there were some issues with the default CSS – so remember to override anything you don’t like – e.g. body having a margin at the top!

Still to come: Adding Menus