We brought everything together in a WordPress theme. We took the default Kubrick theme and modified it to fit our needs. The excellent WordPress Codex served as our guide throughout this process, required reading if you’re going to be making your own templates. The first thing you need to understand is the anatomy of a WordPress theme. All themes are stored in individual folders named after the theme. If you created a theme called “My Super Game Portal”, it would be found here:
/wp-content/themes/my-super-game-portal/
Another handy feature of WordPress themes is the functions.php file. Simply create a file called functions.php in your theme folder and add any custom functions to it. Everything you put in there will be available to your theme automagically. We have custom functions for pulling our top rated games and our newest games out of the database.
The final technical detail you really need to know before being able to customise your own WordPress theme is how to use those custom fields I mentioned earlier. One way we use the custom fields is to set the width and height of each game that we publish.
To use these fields in our template, we simply use the following code on the game page (single.php):
<?php
echo get_post_meta($post->ID, ‘game_width’, true);
echo get_post_meta($post->ID, ‘game_height’, true);
?>
That should be enough to get you started. For more information, you should check out the Theme Development article within the WordPress Codex.
So, that’s how we did it. It was quick and simple, and all made possible by our new friend WordPress. What are you doing still reading? Go and use WordPress to build that game portal you’ve been talking about for the last 2 months!
1 Comment
Hello! Cool post, amazing!!!