WordPress Attachment Page Template Code Snippets

Date: 15th November 2009 at 4:25 am | Filed under: scripts, wordpress | Author: Sam Burdge | Tags: , , , , ,

I haven't written as many WordPress tutorials as usual lately, as I have been so busy building websites and blogs, so I thought I would take the time out to share a few WordPress codes I have developed recently for attachment page templates and specifically the image attachment page template. The attachment page template is the page that displays a single image when the images link URL is set to 'Post URL'. You can set the image's link URL when inserting a single image into a post, and also when using the gallery shortcode.

The codes in this article are mostly applicable to images inserted using the gallery shortcode as they are most useful for posts or pages that have multiple image attachments. Read more about using image and file attachments.

These template codes can be added to your WordPress theme using the attachment.php and image.php files. If these template files do not exist in your theme you can create them, or WordPress will default to using single.php or index.php to show attachments by default. (See more about template hierarchy).

If you don't want to create a seperate image.php or attachment.php template you can always edit the index.php or single.php files and wrap the attachment specific codes in the is_attachment clause like so:

if(is_attachment()){
//attachment page specific code goes here
}

These php functions are loosely based on code I found in this article: Adding text links to WordPress Gallery by Michael Fields. In this article he provides code examples of how to show previous and next thumbnail links in a WP attachment page. I also made use of this previous-next keys in array function which is infinitely useful!

My first set of functions will return text links for previous image, next image and back to gallery. The functions themselves will need to be added to your theme's functions.php file before calling them in your image.php or attachment.php files. So here we go:
Read on…

Leave a Comment

Street Fighter Widget

Date: 26th October 2009 at 1:05 am | Filed under: blog | Author: Sam Burdge | Tags: , , ,

Get your hands on the new Street Fighter 2 widget. You can grab the widget code and embed it on your website, or even your myspace or facebook profile. This flash remake of the game is a very accurate copy of the arcade original featuring all the characters and bonus levels. If you just want to play the game on a website please follow this link:

Play Street Fighter online

Leave a Comment

Video Gallery - Neil Stewart / Fella Pictures

Date: 21st April 2009 at 3:41 pm | Filed under: development, portfolio | Author: Sam Burdge | Tags: , , ,

This week I have been working on improving the 'Moving Image' section of photoneil.com. When I first built the site (designed and built by 76 Creative) the Moving Image page featured Neil's video showreel, since then video has become a more prominent aspect of his work so I have created a video gallery page for the site, allowing him to showcase a range of his video work under different categories.

As this video gallery uses seperate pages for the video list and the player itself I programmed it in PHP using the Longtail / JW Player to play the flv videos. For more information about encoding video for Flash as flv see my article: Encoding FLV

The video gallery also offers the option to download higher quality Quicktime Movies of each video. I encoded the quicktimes using the mpeg-4 codec and reducing the frame size slightly to allow for higher picture and sound quality while keeping the filesizes reasonable for a download.

Check it out: www.photoneil.com/movingimage.php

Leave a Comment

Zakeeya.com - Art & Photography blog sketchbook

Date: 2nd April 2009 at 9:20 pm | Filed under: portfolio | Author: Sam Burdge | Tags: , , , ,

zakeeya-screen

This simple, elegant blog was designed and built by 76 Creative (coded by me:¬)  for London based artist Zakeeya. It is powered by the Gallery Mangement feature of Admin 76, 76 Creative's custom Content Management System.

The Gallery Management system was originally intended for creating a series of galleries, rather than one huge one, so although being simple in appearance on the front end, the back end of this site still posed one or two challenges for me and allowed for improvements to be made to the CMS in the process.

Another thing I enjoyed about this site is doing a layout with a fluid width in CSS, most sites I have done are fixed width so it was interesting to change things up a bit.

I'm a big fan of simplistic / minimal websites where the content is the main focus.  Check it out:

www.zakeeya.com

Leave a Comment

Games Arcade Website powered by WordPress

Date: 28th February 2009 at 4:04 pm | Filed under: blog, portfolio, wordpress | Author: Sam Burdge | Tags: , , , ,

I have recently been working on a highly versatile premium theme for WordPress which is due for release soon. As part of the project I wanted to test how the theme (and WordPress itself) could work with sites of various different genres. My intention was that the theme would be configurable enough via it's Options Menu that it could easily be styled to suit corporate sites such as recruitment, blue chip company, technology site  & product portfolio, media sites such as magazine, news, image & video gallery and also youth oriented sites such as music / band website,  games website.

The theme also features simple integration for banners and advertising,  so creating a couple of  'working example' sites was not only a good way of testing the theme's versatility but also a potential source of a few extra quid!

I had been wanting to do a games & videos website for a while, and I had built the theme's default settings around a 'corporate magazine' look & feel, so I decided the games site would be a great way to test the theme. Here is my wordpress games arcade site so far:  Zap Gamez

I decided to look around and see what articles I could find about creating a games arcade website with wordpress, or if there was a plugin that allowed you to easily insert games into your WordPress blog. I found this article by Emanuele Feronato:

It describes a method of populating your WordPress blog with games via a feed from MochiAds (A source of free games for websites) using custom fields. However, for my site I wanted to be able to integrate games from various free content suppliers and host games on my own server as well as embedding games hosted by content suppliers. What I really wanted was a plugin that could embed games into posts or pages using shortcodes.

THE PLUGIN

The prototype plugin I have built includes the following features:

4 Different views:

  1. Grid view - a grid of thumbnail images linking to each game (can be restricted to a single category or parent category)
  2. Category view - this view includes a medium sized image and a written description of the game
  3. Single page view - the page where you play the game itself
  4. Featured Game view - a page with a list of featured games

Different embedding modes:

  1. iFrame embedding - embed iFrame content using code provided by free games sites, or use this method to display games from your own server where an html file has been provided with the free game download.
  2. Flash embedding - embed Flash content using embed codes provided by other sites, or embed flash games directly from your own site. You can even upload them easily using the wordpress 'Add Media' tool.

The beta version of the WP Game Embed plugin can be found here.

22 Responses to “Games Arcade Website powered by WordPress”

  • Comment by ashish
    Date: March 17th, 2009 at 7:58 am

    good article, thanks for this useful info, I have dug and stumbled this article. I will keep visiting for more useful information.

  • Comment by alex
    Date: March 27th, 2009 at 2:01 pm

    great article. thank

  • Comment by fencze
    Date: April 21st, 2009 at 8:03 am

    this game is so good I have played it several days ago

  • Comment by Budi
    Date: April 23rd, 2009 at 1:34 pm

    Keep it up man! Now, when I need useful info I’ll come here.
    Smarter than an average blog…cheers

  • Comment by Steven
    Date: May 19th, 2009 at 1:52 am

    Nice Kindly visit my site

  • Comment by Games Arcade Website powered by WordPress Sam Burdge | Cast Iron Cookware
    Date: May 26th, 2009 at 8:32 pm

    [...] Games Arcade Website powered by WordPress Sam Burdge Posted by root 19 hours ago (http://www.samburdge.co.uk) 4 responses to games arcade website powered by wordpress comment by ashish date march 17th 2009 at 7 58 am good article thanks for this useful info Discuss  |  Bury |  News | games arcade website powered by wordpress sam burdge [...]

  • Comment by kansas city bbq
    Date: May 29th, 2009 at 3:48 pm

    This is a great game. Great info

  • Comment by Games Arcade Website powered by WordPress Sam Burdge | Paid Surveys
    Date: May 29th, 2009 at 4:34 pm

    [...] Games Arcade Website powered by WordPress Sam Burdge Posted by root 6 hours ago (http://www.samburdge.co.uk) 5 responses to games arcade website powered by wordpress comment by ashish comment by budi date april 23rd 2009 at 1 34 pm keep it up man reliable web hosting linux amp windows hosting starting at just 1 99 per month Discuss  |  Bury |  News | games arcade website powered by wordpress sam burdge [...]

  • Comment by free business advertising
    Date: June 15th, 2009 at 2:42 am

    wow i think wordpress just for blog, but im wrong, good idea bro

  • Comment by pikachu
    Date: June 16th, 2009 at 8:04 pm

    visit mine i have lotz of free games too -yay-

  • Comment by eaonflux
    Date: June 19th, 2009 at 7:05 am

    Nice plugin, made myself also a mochiads wordpress plugin, its still in decelopment.
    i heavily cusomized a video theme for the layout.
    you might wanne check it some times.
    god job…
    grts,

    chris

  • Comment by Dave Smith
    Date: July 10th, 2009 at 5:18 am

    Hey, this is cool free stuff

  • Comment by fred bennett
    Date: July 17th, 2009 at 2:58 am

    Awesome post. Very informative :)

  • Comment by Sam Burdge
    Date: August 3rd, 2009 at 3:49 pm

    This post must contain keywords that are attracting too many spam bots. Sorry but comments are now closed on this post.

  • Comment by Jambo
    Date: August 18th, 2009 at 7:37 pm

    i am new to wordpress but i like this site, good article… and i like the sound od the flash arcade….

  • Comment by bayu
    Date: August 30th, 2009 at 5:00 pm

    i have downloaded your beta plugins, nice plugin mate, thanks

  • Comment by Neo
    Date: September 13th, 2009 at 1:12 pm

    So, this is interesting for me, I will translate it and post to my saite http://grang.info Thanks, Alex

  • Comment by LacnyWebHosting
    Date: October 2nd, 2009 at 2:14 pm

    Great article, adding it to my bookmarks!

  • Comment by blackhatguide
    Date: October 12th, 2009 at 10:28 pm

    Great work with the blog mate let me know if you want to partner up with my blog as well! =]

  • Comment by Jocuri barbie
    Date: October 22nd, 2009 at 3:17 pm

    Nice your beta :) I’ll gonna translate in romanian language this post and i will put a direct link to your site. Thank you

  • Comment by Kwik Games
    Date: November 5th, 2009 at 9:35 pm

    Very cool. I finally got around to changing my own games site, http://www.kwikgames.com over to Wordpress earlier this year. After years of updating static HTML pages it was high time I made the switch and was thoroughly worth it…

    I love your thumbnail “grid”! You might want to use a rating plugin, there are quite a few good ones, so you can show most popular games and encourage more user interaction, but overall it looks great. And to anyone thinking of using WP for a games site I highly recommend it!

  • Comment by kral oyun
    Date: November 6th, 2009 at 2:29 am

    that is what i need :) thanks!

Leave a Comment