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…

15 Responses to “WordPress Attachment Page Template Code Snippets”

  • Comment by doriggidy
    Date: April 25th, 2010 at 8:08 pm

    Hi this is a great tutorial. I’m currently using nextgen gallery but want to try your gallery on my sister’s blog…so using the built in image features of WP seem to be the best solution. What you have here should be perfect for her. Great job. One question, If I wanted to have the images themselves link to the next image…how wold i do that?

  • Comment by muscle car
    Date: May 24th, 2010 at 4:29 pm

    hay that’s the cool one,but how to create thumbnail picture in random,place in sidebar or in home page header,thaks b4

  • Comment by Ted
    Date: May 27th, 2010 at 11:47 pm

    This worked perfectly for me … except, for some reason I can’t get the image captions to display. Any thoughts why they might not be coming in?

  • Comment by Shariff
    Date: July 7th, 2010 at 4:13 pm

    Wonderful Tutorial, at last I found it, I am going to try this in my blog.

    Great Going

  • Comment by Jason
    Date: July 9th, 2010 at 4:16 pm

    Thank you for this tutorial, it helped me immensely.

  • Comment by David Hobson
    Date: August 5th, 2010 at 3:59 pm

    First let me say, I am an experienced computer/internet user, however my developer side is still just an apprentice. But as a user, the second I saw white and other colored text on black background, I closed it and went on. I decided to come back and let you know because I’m sure I’m no the only one who’s done so. You might want to see what other developers think and if this technique is advisable. At least my eyes are hurting right now. Peace.

  • Comment by 2k
    Date: October 4th, 2010 at 12:27 pm

    Hi, excellent function to output the all thumbnails to attachments.php Would be amazely cool to adapting it to single.php. Is there any way to output all thumbnails the same way for single.php?

  • Comment by michelle
    Date: October 26th, 2010 at 12:56 am

    Very helpful. Thank you!

  • Comment by Clark
    Date: January 16th, 2011 at 7:38 pm

    Helpful stuff, exactly what I needed!

  • Comment by David
    Date: January 23rd, 2011 at 11:20 am

    Hi, nice tuto ! I just want to say I think the function array_navigate / prev_att_link / next_att_link could be done with one line of code ! See the wordpress function : wp_link_pages(); (http://codex.wordpress.org/Function_Reference/wp_link_pages) and to see an exemple you can look the code of the attachment.php twentyten wordpress theme.

  • Comment by David
    Date: January 23rd, 2011 at 2:15 pm

    Sorry, it’s not wp_link_pages () but previous_image_link(false) and next_image_link () with false option to insert the title : http://codex.wordpress.org/Function_Reference/previous_image_link

  • Comment by onetrek
    Date: February 27th, 2011 at 5:21 am

    This tutorial is good. But it difficult to read because of the page color. Font size if too small. As a web developer I Suggest you to make your template white color. and big font size.

  • Comment by Marirano MARINI
    Date: March 31st, 2011 at 7:44 am

    When I split an article into 2 column the first row of the second column start one line bottom.
    How can I prevent this?

    Thank you. I appreciate your job and I’ll use it when this “bug” will be take off.
    Great work!

  • Comment by surface encounters
    Date: April 7th, 2011 at 5:17 pm

    Thanks manos! Taking the two leading spaced off the end of the functions.php file worked great. Thanks!

  • Comment by Kevin
    Date: June 21st, 2011 at 8:02 pm

    Thanks for the thumbnail function! Works great!!!
    The selecting of text with your particular color scheme is hard to see though!
    Excellent work =)

Leave a Comment

Bespoke theming for WordPress Arcade sites

Date: 12th March 2009 at 7:00 pm | Filed under: blog, portfolio, themes | Author: Sam Burdge | Tags: , , , , , , , , ,

loopy1loopy2loopy4loopy3

Screenshots from the new Loopy Pursuits Arcade Site.

I have recently entered the world of Arade Website webmastering and, being the WordPress geek I clearly am, have chosen WP as the management sytem to drive my arcade sites. I have developed two new plugins WP Games Embed (released) and WP Mochi (so far unreleased) and launched my first arcade site Zap Gamez.

In the past I have had a fair few jobs designing custom / bespoke themes for WordPress blogs and for sites that use WP more as a CMS. These jobs are where most of my plugins originate from, adding custom features to sites when no existing plugin is available to achieve the same functionality.

My most recent custom theme is for the arcade site Loopy Pursuits, for which the games content is also driven by my two plugins WP Games Embed & WP Mochi. The theme is incredibly simple - no sidebar or nav bar as such, 3 basic layouts - Home page, Category/Tag/Search results page & single page view where the game itself is displayed. Apart from the formatting of the comments there is nothing about the theme which suggests it is wordpress. No 'recent posts','blogroll' or 'tag cloud' or any other content that could be associated with standard WP blog design.

The theme incorporates google advertising interspersed with the content. My approach to google advertising with arcade sites is to use predominantly image ads as gaming is very visual, and image ads seem to sit better within a very image based site layout. I also use the standard approach of identifying key placements for ads, sometimes referred to as 'Hot Spots', which are normally adjacent to key areas of the page, such as navigation, main content (i.e. the game), etc.

During the development of Loopy Pursuits the WP Mochi Plugin has come a lot closer to releaseability. It still lacks an options page which it would definitely need, but it now incorporates the Mochi Leaderboard (score board) using the Mochi Publisher Bridge, it also now has the ability to add entire directories of games automatically too!

If you are interested in getting a custom design for your WordPress blog, or if you want an arcade website set up, or if you are trying to do something different / unusual with WordPress please feel free to get in touch. I would be happy to provide a quote for any such jobs. I have been working with WordPress since version 1.2 and have set up many WP blogs in that time, I have never used a theme by someone else, custom built is the only way for me!

8 Responses to “Bespoke theming for WordPress Arcade sites”

  • Comment by العاب
    Date: April 4th, 2009 at 11:16 am

    look at my site
    its an arcade power by wordpress

  • Comment by GameGag
    Date: June 8th, 2009 at 11:18 pm

    Wow what a great looking theams, please keep up your innovative touch.

  • Comment by EnjoySilk
    Date: September 18th, 2009 at 1:22 pm

    It’s so beautiful theme!

  • Comment by Frank
    Date: January 9th, 2010 at 2:13 am

    Great theme. My site looks great with this. Thanks

  • Comment by web rs
    Date: February 1st, 2010 at 8:38 am

    How can I download this theme .. ?

  • Comment by WpArcades
    Date: July 4th, 2010 at 4:45 pm

    That looks sweet. Nice job. Wordpress is the best to make arcades on.

  • Comment by SuperGames Fun
    Date: February 14th, 2011 at 3:37 pm

    I Just use a free wordpress theme in my auto post arcade website, I interest with embeded plugin, but I havenot used it cause the mochie games not properly install.

  • Comment by Gladiator Games
    Date: March 6th, 2011 at 4:50 pm

    Great article. WP is has so many options and is super fun to use to create arcades.

Leave a Comment

Growing Userbase for my Simplistix Theme for WordPress

Date: 12th February 2009 at 10:25 pm | Filed under: blog, themes, wordpress | Author: Sam Burdge | Tags: , , ,

After releasing my WordPress theme Simplistix into the wild a few weeks ago I have been very happy, and somewhat surprised by it's popularity. It has received hundreds of downloads from my site and over 700 downloads from wordpress.org in the last 12 days. I knew that there was a niche for simple, text based blog themes as I had seen a few sites such as www.plaintxt.org that are entirely devoted to these type of themes. But, with all the sophisticated and complex wordpress themes on offer, Simplistix feels like quite a humble little theme — perhaps that's part of it's charm.

Anyway, seeing the download stats made me feel curious about who was using the theme. I had already seen it being used on a couple of blogs because, as with most wordpress projects, I had received some suggestions, ideas, support requests and constructive criticisms from members of the wordpress community. I did a bit of further research on google and instantly found loads more bloggers using my theme. The main thing that struck me was the diversity of subject matter that these blogs covered – science, computer programming, economics, movies, music, art, fashion and many more. It was also nice to see instances where people had modified the theme, adding in their own site headers, sidebar widgets, google advertising, etc.

I felt so inspired by seeing all these sites using Simplistix as their theme that I decided to write this post featuring some of my favourites. So here they are:

TOP PICKS

www.flyhypersonic.com – The seatbelt sign is illuminated
www.thewherewithal.org – Blogging about credit, debt, money, economy, theory
nicolasulloa.com/blog – Music, Animation, Graphic Arts and Illustration
www.ianthewebsite.com – If you could be any blog, what blog would you be?
2chicksblogging.com – Blogging for Change Training since 2008
feedingme.com
blog.nakedsteve.com – Oh hey is that a monome?

THE BEST OF THE REST

phoward.com/blog
ponasniekas.nespalvotas.lt
www.bigtechcenter.info
www.bletherskite.com
blog.xieer.com
www.bestmusiccenter.info
www.businesstechnologytimes.com/wordpress
likeitreallymatters.com
hasibul.info/blog

I am planning an update to the theme in the near future where I will add an options menu which will allow you to control colours, fonts etc.

Leave a Comment

Simplistix and 76 Digital Orange Themes Now Available @ WordPress.org

Date: 31st January 2009 at 3:38 pm | Filed under: themes, wordpress | Author: Sam Burdge | Tags: , , ,

My WordPress themes 76 digital orange and Simplistix are now available at wordpress.org. Here are the links:

For some reason WordPress uses my forum username 'sammyb' as the author name for the themes. With plugins it reads the author name from the plugin file, this obviously doesn't work the same way with themes!

2 Responses to “Simplistix and 76 Digital Orange Themes Now Available @ WordPress.org”

Leave a Comment

WP Holding Page Theme

Date: 30th January 2009 at 1:59 am | Filed under: themes, wordpress | Author: Sam Burdge | Tags: , , , ,

The WP Holding Page theme for WordPress is intended for use at times when your site is undergoing maintenance, or is under construction. There are a few themes and plugins out there that also serve this same purpose, the main advantages of this theme are:

  1. Simple basic classy design.
  2. Easy to install & works 'straight out of the box'
  3. Configurable text,colours, fonts and styles via an  Options Page

You can enter you own text for your holding page via the WP Holding Page Options tab in WordPress.

INSTALLATION:

  1. Download the theme from the link at the bottom of this post.
  2. Upload the theme to your wp-conent/themes folder.
  3. Select the theme from the 'Appearance' page in your WordPress and activate it.
  4. Optionally you can configure the theme via the 'WP Holding Page Options' tab under 'Appearance' in WordPress

CONFIGURATION:

You can configure your holding page via the 'WP Holding Page Options' tab under 'Appearance' in WordPress. Here is a list of available options:

  1. Title text
  2. Body text
  3. Text colour
  4. Background colour
  5. Font style
  6. Title size
  7. Text size
  8. Page alignment

Options page screenshot:
options

THEME SCREENSHOTS:

hp1hp2hp6hp3hp4

DOWNLOAD:


6 Responses to “WP Holding Page Theme”

  • Comment by pressitfor.me
    Date: January 31st, 2009 at 3:00 pm

    WP Holding Page Theme | Sam Burdge…

    The WP Holding Page theme for WordPress is intended for use at times when your site is undergoing maintenance, or is under construction. There are a few themes and plugins out there that also serve this same purpose, the main advantages of this theme a…

  • Comment by WP Holding Page | Simple Themes
    Date: February 25th, 2009 at 1:51 pm

    [...] Release Page [...]

  • Comment by Under Construction Themes for WordPress
    Date: September 3rd, 2009 at 7:00 am

    [...] WP Holding Page Release Page [...]

  • Comment by Don’t show your working | Blog Mum | WordPress made easy
    Date: November 27th, 2009 at 1:54 am

    [...] will need: the WP Holding Page theme; the Theme Test Drive plugin, and of course a WP [...]

  • Comment by WP Holding Page Template
    Date: May 2nd, 2010 at 4:23 am

    [...] Preview — Download [...]

  • Comment by mikhel
    Date: October 24th, 2010 at 4:37 am

    This theme would be so cooler if there was a way to include an image to the page and more ways to interact with the viewer.

Leave a Comment