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

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.

39 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!

  • Comment by Arcade
    Date: January 29th, 2010 at 10:08 pm

    Very nice articles. Thanks men.

  • Comment by idic
    Date: March 14th, 2010 at 2:16 pm

    Nice article. But there are other sides which are based on wordpress and use mochi games: http://highscoregaming.net
    Cheers idic

  • Comment by Nick
    Date: June 15th, 2010 at 1:16 am

    The wordpress site looks good. I especially like the huge thumbs.

  • Comment by kız oyunları
    Date: June 20th, 2010 at 1:04 pm

    Very cool. I finally got around to changing my own games site

  • Comment by love games
    Date: June 20th, 2010 at 1:05 pm

    i heavily cusomized a video theme for the layout.
    you might wanne check it some times.
    god job…

  • Comment by anime and games
    Date: July 16th, 2010 at 4:09 pm

    I like playing Games..So I make blog and include many games..In order that if I want to play game just open my blog.

    Regard
    Ali Mustika Sari

  • Comment by Ricky Davis
    Date: July 29th, 2010 at 3:18 am

    How has this theme been going? any updates on this one? There has been lots of game themes now and I`m hoping you were successful on this.

  • Comment by kız oyunu
    Date: September 6th, 2010 at 7:15 am

    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 Free WWE Games
    Date: November 23rd, 2010 at 1:34 pm

    I think is a great idea, keep up the great work. Looking forward for some updates on this.
    Thanks.

  • Comment by snooty
    Date: January 1st, 2011 at 8:45 am

    Nice article. But there are other sides which are based on wordpress and use mochi games: http://www.ccymx.com/
    Cheers idic

  • Comment by Jenny Stalker
    Date: January 15th, 2011 at 1:44 pm

    wow, I rarely ever have to scroll down this much just to comment on a post before. Great post, keep them coming!

  • Comment by Tanja Brociner
    Date: January 18th, 2011 at 3:27 pm

    What will they imagine next? In many instances, They’ll guarantee you

  • Comment by cubetz
    Date: January 25th, 2011 at 1:40 pm

    yep. still waiting for some new info. A game theme would be great adition to all of us.

  • Comment by Multiplayers Games
    Date: March 22nd, 2011 at 10:08 am

    Awesome, im testing this on my site, thanks for making it!

  • Comment by Nickelodeon Games
    Date: April 3rd, 2011 at 12:10 pm

    Thanks alot mate, this is a really nice info about WordPress game :) I’m bookmarking this page!!

  • Comment by Play Ms Pacman
    Date: April 21st, 2011 at 7:24 pm

    My website http://playmspacman.net is also powered by Wordpress and I can say that it is doing very well.

  • Comment by Dem Managment
    Date: May 25th, 2011 at 8:23 am

    i love this thing wordprees is now in games also

Leave a Comment

WP Games Embed Plugin

Date: 28th February 2009 at 1:27 am | Filed under: development, plugins, wordpress | Author: Sam Burdge | Tags: , , ,

Turn your wordpress blog into a games arcade!

This beta version WordPress plugin, WP Games Embed, makes it easy to embed games into your WordPress blog by using shortcodes in your posts and pages. WP Games Embed is intended to be able to support content offered by the various free games sites out there using the codes or downloads they provide.

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 - this view is similar to category view, but allows you to pick the games yourself to create your own 'Featured Games' page.

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.

WORKING EXAMPLE

Visit Zap Gamez Arcade to see an example of the plugin in action.

INSTALLATION

  1. Download the plugin from the link at the bottom of this page
  2. Upload the wp-games-embed.php file to your wp-content/plugins folder.
  3. Activate the plugin from the Plugins page in WordPress.

USAGE

Use shortcodes to embed games into your posts, or to create a grid of thumbnails on a page or your home page.

Embedding a game in a post:

Shortcode: [game /]

Additional attributes:

  • width - the width of the game
  • height - the height of the game
  • src - the url of the game (html file for iframe embedding, swf file for flash embedding)
  • flash - if set to true flash embedding will be used, if set to false iframe embedding will be used. (default=false)
  • thumb - the url of the thumbnail image (70px x 60px)
  • main - the url of the large image (appx 300px wide)
  • title - the name of the game!
  • description - your description including controls etc.
  • featured - whether this should be formatted as a featured game. (default=false)
  • game_url - only to be used in Featured mode (when featured is set to true). See  the shortcode examples below for more details.

Shortcode Example 1 (embedding game as iFrame):

[game width="640" height="480" src="http://www.example.com/games/pacman.html" thumb="http://www.mysite.com/images/pacman-small.jpg" main="http://www.mysite.com/images/pacman-medium.jpg" title="PacMan" description="This is a great game! Use the arrow keys to play." flash="false"/]

Shortcode Example 2 (embedding game as Flash):

[game width="640" height="480" src="http://www.mysite.com/games/pacman.swf" thumb="http://www.mysite.com/images/pacman-small.jpg" main="http://www.mysite.com/images/pacman-medium.jpg" title="PacMan" description="This is a great game! Use the arrow keys to play." flash="true"/]

Creating a grid of thumbnails on a page:

Shortcode: [get_latest_games /]

Additional attributes: list_category - the category id for the games you want to appear in the list.

The list_category attribute makes it possible to display the latest games under a certain category e.g. 'Arcade' or the latest games under all categories. Simply set up a main category called 'games' and then create all your games categories (action,adventure,sports, etc.)  as sub-categories.

Shortcode Example 3 (thumbnail grid):

[get_latest_games list_category="2" /]

Creating a Featured Games page:

Shortcode: [game /]
Additional atrtributes: (see above)

The important attributes for creating a features games list are 'featured' which should be set to true, and 'game_url' the url where the game can be played on your site.

Shortcode Example 4 (featured games):

[game  main="http://www.myblog.com/uploads/pacman-medium.jpg" title="PacMan" description="This is a great game! Use the arrow keys to play." featured="true" game_url= "http://www.myblog.com/games/pacman/" /]

[game  main="http://www.myblog.com/uploads/donkeykong-medium.jpg" title="Donkey Kong" description="This is a great game! Use the arrow keys to play." featured="true" game_url= "http://www.myblog.com/games/donkey-kong/" /]

DOWNLOAD THE PLUGIN


26 Responses to “WP Games Embed Plugin”

  • Comment by imad
    Date: March 5th, 2009 at 11:28 am

    good work:) I am going to install it , I have also interest in the wp Mochi plugin..
    Thanx for sharing

  • Comment by Sam Burdge
    Date: March 5th, 2009 at 2:02 pm

    Hi Imad
    Good luck! Don’t forget to post a link to your arcade here as an example…
    The mochi plugin needs a bit more development to integrate the mochi ‘bridge’ which gives the scoreboard functionality etc.
    Sam

  • Comment by The Wordpress Arcade Experiment Has Begun! - Page 2 - Talk Arcades
    Date: March 12th, 2009 at 9:34 pm

    [...] the WP Super Cache plugin, which speeds it up a lot! I have also developed a wordpress plugin WP Games Embed (very much a beta at the moment) which allows you to embed games in a wordpress blog with various [...]

  • Comment by acrylic
    Date: March 19th, 2009 at 9:29 pm

    Hello Sam and thanks for this wonderful plugin.

    I only have a slight problem with the get_latest_games shortcode. Every time I put in and define the category (for example 20) it lists all content from all categories. It might be a bug or might be something that I’m looking over.

    Thanks for your help

  • Comment by Sam Burdge
    Date: March 20th, 2009 at 2:10 am

    Hi Acrylic

    The get_latest_games shortcode will return all posts under a category, and all posts under child categories of that category. So if you have a main category called ‘games’ with an id of 1 and sub-categories of games such as ‘action’ (id =2), ‘arcade’ (id = 3), ‘fighting’ (id =4), etc. if you call category 1 in get_latest_games you will get all games, but if you call category 2 you should just get ‘action’ games.

    If this doesn’t help please comment again as it is this type of feedback that helps me to develop and improve my plugins over time.

    Sam

  • Comment by acrylic
    Date: March 20th, 2009 at 3:20 pm

    Hi Sam!

    I tweaked the code a bit and now it’s doing what I need. My concept was to have the grid system represented on a separate wordpress page rather than in a single post.

    So I created a new page template. The problem that I encountered was that the page template gets the content by running the loop first but the ep-embed.php runs the loop again. So what happens is that the page template loops through all the posts you have and displays the content.

    What I did was that I omitted the while loop and left the if conditional in. In this way the loop only runs when you have a content in your page and retrieves it. Once it happens it activates your function call which loops through the given parameters and retrieves all the game posts.

    I hope I made sense :/

  • Comment by Harri Nyman
    Date: March 26th, 2009 at 11:52 am

    Interesting plugin, no doubt - however I have interesting dilemma, is there some kind of limit how many games is needed before grid appears? On my site it’s not working, at least not yet.

  • Comment by Exam Philippines
    Date: April 1st, 2009 at 4:29 pm

    thank you so much for sharing this plugin. really helpful to my game site

  • Comment by Bilal
    Date: April 11th, 2009 at 7:10 pm

    Hi, great plugin.
    One question, if we use feeds to get mochi games can we use this plugin to show those games in posts?

  • Comment by Create a Wordpress Arcade | I love games
    Date: April 20th, 2009 at 6:15 am

    [...] wp-games-embed-plugin [...]

  • Comment by Eoin
    Date: May 7th, 2009 at 1:41 am

    Hi,
    I’m trying to get this to work, but can’t quite get it right. The plugin is activated - and this is code that I’m trying to use - (I changed example.com and mysite.com to our site)
    [game width="640" height="480" src="http://www.skuzziport.com/games/pacman.html" thumb="http://www.skuzziport.com/images/pacman-small.jpg" main="http://www.skuzziport.com/images/pacman-medium.jpg" title="PacMan" description="This is a great game! Use the arrow keys to play." flash="false"/]
    grateful for tips!

  • Comment by Sam Burdge
    Date: May 9th, 2009 at 9:50 am

    Hi Eoin
    In what way is it not working? Do you have an example I can look at?

  • Comment by Mark
    Date: September 19th, 2009 at 3:48 am

    Thanks for this little plugin…it works a treat.
    I’m gonna use it to add games as I go along, and then put a category page up… in the meantime I’ll just add each game I find as a blog post.

    The 1st game attempt can be found here….

    http://www.foundstuff.co.uk/2009/magic-towers-solitaire-an-addictive-little-solitaire-game/

    Excellent plugin and simple to use.

  • Comment by Steve
    Date: October 30th, 2009 at 3:13 am

    Well it seems to me to be quite useless, the grid view shows evey post of the whole blog, fine if 2-3 is all you have, but when in the 1,000s very terrible.

  • Comment by Ronnie
    Date: January 11th, 2010 at 11:49 am

    When I click the game, it just reloads the page..

    Example:
    http://www.munkholmvej41.dk/?page_id=487

  • Comment by shiv
    Date: February 17th, 2010 at 8:08 am

    hie friends i have installed but unable to put the games in blog.. help me out….

  • Comment by Transformez votre Blog en plateforme de jeux vidéos! | 5axe Deluxe Edition – Le blog
    Date: May 30th, 2010 at 11:34 am

    [...] de l’auteur : ici A VOIR AUSSI :Embed iFrame Plugin pour [...]

  • Comment by 5 plugins para criar um site de games flash em Wordpress | Templates e Wordpress Themes
    Date: June 3rd, 2010 at 3:10 pm

    [...] 4. WORDPRESS GAMES EMBED [...]

  • Comment by Crie um site de games em flash em Wordpress :: Tutoriais CTDO - Sua Base de Tutoriais Online
    Date: June 10th, 2010 at 9:45 am

    [...] quando você considera que é bastante mais acessível que todos os seus competidores.04. Wordpress Games EmbedEste plugin Wordpress, ainda em versão beta, é gratuito e lhe permite embutir games flash [...]

  • Comment by lousy jones
    Date: June 13th, 2010 at 3:04 pm

    well thanks for this, but it just refreshes the page loaded once

  • Comment by Crie um site de games em flash em WordPress « Diogo Paixão
    Date: August 23rd, 2010 at 2:24 am

    [...] 04. WordPress Games Embed [...]

  • Comment by Ana
    Date: August 23rd, 2010 at 12:58 pm

    Hi!
    I tried the code for the “Grid” and it is not working, can you please check?
    http://www.juegoxdia.com/?page_id=23
    thanks
    Ana

  • Comment by Super Games
    Date: October 2nd, 2010 at 6:19 pm

    Thanks , I’ll try on my next site.

  • Comment by Plugins para criar um site de jogos com Wordpress | Criar / Fazer site grátis,logomarcas,criar blog, dicas de como criar
    Date: October 6th, 2010 at 1:51 pm

    [...] 04. WordPress Games Embed [...]

  • Comment by How To Embed Mochi Flash Games Into Your Blog Posts | techtikus.com
    Date: March 23rd, 2011 at 3:53 am

    [...] can set attributes such as width and height according to your blogs measurements.  Here is a list of other attributes that you can use with the short [...]

  • Comment by arielsan
    Date: May 27th, 2011 at 2:49 pm

    Sam, I tried to use the plug-in using the same example for iframes (no flash), and I believe you have a bug in your code or in your example. The thing is, if you define flash=”false” (I want to use iframes) then the variable flash will be defined as string “false” but in your code you are checking for if($flash) and that will return true whatever the value of flash variable is. As a user, if you don’t want flash, you will have to remove the flash parameter.

    [game ... flash="false"] -> [game ...]

Leave a Comment

Style highlighted / selected text - CSS Tutorial

Date: 26th October 2008 at 12:56 pm | Filed under: scripts | Author: Sam Burdge

Ever wondered how to change the default style of highlighted or selected text in your html page? I have found that this is possible using CSS3, although IE has no support for this so it doesn't work at all in IE.

In this example the background is set to green and the text set to white. Drag over this text to highlight it.

Here's the CSS:

/* Safari */
::selection {
background: #000000;
color: #ffffff;
}
/* Firefox */
::-moz-selection {
background: #000000;
color: #ffffff;
}

::selection is supported by the latest versions of Opera and Firefox 2 and upwards. ::-moz-selection is supported by the latest versions of Safari.

1 Response to “Style highlighted / selected text - CSS Tutorial”

  • Comment by roy
    Date: July 2nd, 2009 at 11:13 am

    thank you very much looking for this for a while, had no idea what to look for to find it either, thanks!

Leave a Comment

WordPress - Change Default Email Address Plugin

Date: 20th February 2008 at 12:04 am | Filed under: development, plugins, wordpress | Author: Sam Burdge

This WordPress plugin changes the default email address that all notifications sent from your blog are addressed from. The default address for all emails sent by your blog is currently wordpress@ yoursite.com.

I had seen some tutorials / forum entries previously where people suggested editing the core WordPress file 'pluggable.php' to overide this default. This method does work, however you would have to repeat the hack every time you upgrade to a new version of WordPress so it is not an ideal solution.

Faced with this problem for a site I was working on recently, I wrote this basic plugin which allows you to configure your own email address in the format: Your Name <yourname@yoursite.com>.

Installation:

  1. Upload the file wp_change_default_email.php to your wp-content/plugins folder
  2. Activate the plugin from the Plugins page in WordPress

Usage:

  1. In the Plugins page in WordPress click the edit button next to the plugin in the list.
  2. Scroll down until you see a note saying 'Configure it'
  3. Enter your name and email as shown
  4. If you don't enter a new address the default 'wordpress@' will remain

Download:


40 Responses to “WordPress - Change Default Email Address Plugin”

  • Comment by Shane
    Date: February 29th, 2008 at 8:33 am

    Works great - thank you!

  • Comment by Change Default Email Address » Wordpress Plugins
    Date: July 9th, 2008 at 6:56 am

    [...] Version: 0.1 - License: n/a - Author: Sam Burge - Plugin Page - » Download [...]

  • Comment by Shane
    Date: August 25th, 2008 at 10:27 pm

    Is there a newer version than 0.1? I upgraded to WordPress 2.6.1 and the Plugins area is telling me that there is a new version, but the new version links to:
    GALLERY LIGHTBOX PLUGIN
    http://wordpress.org/extend/plugins/wp-25-gallery-lightbox-plugin/

    Also, just an FYI, version 0.1 now conflicts with the Subscribe2 plugin.

  • Comment by Greg
    Date: September 17th, 2008 at 8:06 pm

    Very handy little plug-in, works like a charm, thanks.

    I’m experiencing a little weirdness, though. I downloaded it from your site. When I install it, it works fine but I get an alert telling me there’s a new version 1.3 (the code says “Version 0.1″) and the link to get the new version points at http://wordpress.org/extend/plugins/wp-25-gallery-lightbox-plugin/ which is clearly wrong. The “Upgrade automatically” option doesn’t work either, with the error mentioning wp-25-gallery.

    Since it works, the only reason I care is I don’t want the little orange flag over “Plugins” in my dashboard, but seems like something you’d want to know.

  • Comment by huski
    Date: October 23rd, 2008 at 10:19 am

    wordpress 2.5
    not working for me, i made the two changes , name and email to the php file, verified the changes were saved in the php file, but it continues to send wordpress and wordpress@domain

    ????

  • Comment by m1k3y
    Date: February 9th, 2009 at 11:06 pm

    Great Job!
    THX !!!

  • Comment by marco
    Date: February 16th, 2009 at 5:08 am

    Hi

    IS the email address restricted to the domain of the website? OR can any email address be used, say gmail account?

  • Comment by marco
    Date: February 21st, 2009 at 11:50 pm

    Hi

    This appears like it will do the (magik) trick but I have an unusual situation in which the email address my client wants for default does not use the website’s domain name in it. So simply setting the name in front of the @ symbol is not sufficient - and neither is my confidence in editing your php to accomodate it. Could write up a note on how this customization in the php file would go?
    Sorry for the xtra trouble. Really appreciate your efforts with this as you can imagine.

    /marco

  • Comment by Açıklamalı 200 Wordpress Eklentisi (Part2) | Paylaşım Keyfi
    Date: March 1st, 2009 at 7:25 pm

    [...] © Change Default Email Address Wordpress varsayılan e-posta adresini değiştirebilmenizi [...]

  • Comment by Beth
    Date: August 3rd, 2009 at 6:40 pm

    I had no idea this was even an issue. I thought that it would just show up with my email by default. That’s dumb.

  • Comment by WordPress için tam 400 eklenti birsayfada! | PiyanoDegil.org :)
    Date: September 2nd, 2009 at 2:59 pm

    [...] © Change Default Email Address Wordpress varsayılan e-posta adresini değiştirebilmenizi [...]

  • Comment by Marcus Naylor
    Date: September 8th, 2009 at 3:35 pm

    Made the changes in the plugin editor, added my From Name and the from Address, updated changes and nothing happened. Still coming from Wordpress

  • Comment by Açıklamalı 200 Adet Wordpress Eklenti Arşivi 2 | Akgün-Web Ailesi
    Date: September 18th, 2009 at 5:29 pm

    [...] © Change Default Email Address Wordpress varsayılan e-posta adresini değiştirebilmenizi [...]

  • Comment by Como mudar endereço email do Wordpress
    Date: October 30th, 2009 at 10:49 am

    [...] ou pode fazer Download do plugin AQUI [...]

  • Comment by Adam
    Date: November 3rd, 2009 at 5:05 pm

    This is a life saver. We were testing the site and discovered the “wordpress@”. We knew we didn’t want that. Wordpress really need to allow users to change this from the dashboard. But anyway, this works perfectly and I wanted to thank you Sam for sharing your expertise with us.

  • Comment by Harry
    Date: November 6th, 2009 at 10:40 am

    Thanks for the plugin.

  • Comment by Tony
    Date: November 14th, 2009 at 1:27 pm

    Works Great!!!!! Thanks!!!

  • Comment by Rhino
    Date: November 21st, 2009 at 12:36 pm

    Hi,
    Thanks for your great plugin. I were used it in my blog, it run so cool. But i have a problem with my language. I use Vietnamese language and the email appear: [Tranh biếm hỠa Việt Nam] Có thà nh viên mới đăng kí

    Can you help me this problem?
    Thanks!

  • Comment by Wordpress 400 Eklenti « www.hakanersoy.org
    Date: January 2nd, 2010 at 12:53 pm

    [...] © Change Default Email Address Wordpress varsayılan e-posta adresini değiştirebilmenizi [...]

  • Comment by Norguad
    Date: January 8th, 2010 at 7:04 pm

    Hi, I used the plugin, but it turns all non-latin characters into weird characeters (for example: é is é or ř is Å™). Do you know how to solve it?

    Thank you very much.

  • Comment by Heath
    Date: March 9th, 2010 at 2:32 am

    Great
    thanhk you sam

  • Comment by Peter F.
    Date: March 9th, 2010 at 3:53 am

    Awesome plugin, guys! Works like a charm, and solves a problem I was afraid would be very tedious.

  • Comment by sol97one
    Date: March 10th, 2010 at 7:03 am

    Thanks a lot ! Very useful !

  • Comment by Terje
    Date: March 15th, 2010 at 12:51 pm

    Same as the others, i have problem with some signs. I try to write the norwegian letter “ø/ø” (ascii ø), but i cant get it to work

  • Comment by frank
    Date: March 21st, 2010 at 12:08 pm

    Hi there, this is a very helpful plugin, I have the same problems with the charset or something else. After installing the plugin I always receive weird characters in my mails. ÖÄÜ are not transformed properly. Thanks. F

  • Comment by Mike
    Date: April 5th, 2010 at 2:03 pm

    Great, thanks for the plugin…If you all are looking for a less extensible…but easier way to modify the email “From” line in wordpress, it’s on line 352 in pluggable.php. Just change [code]$from_name = ‘WordPress’;[/code] to something like…[code]$from_name = ‘Mike’;[/code]

  • Comment by Joshua
    Date: April 5th, 2010 at 11:52 pm

    I am using WP MU 2.9.2. I have installed the plugin and activated successfully. Yet I dont see any settings to configure !!!??

  • Comment by me2t
    Date: April 18th, 2010 at 2:02 pm

    i love this plug in very much.thanx

  • Comment by bosschan
    Date: May 9th, 2010 at 2:16 pm

    give thanx!

  • Comment by Jim
    Date: May 20th, 2010 at 2:10 pm

    Hey, thanks for this plugin, helped me sort out a really annoying reg problem I had :D

  • Comment by PLnet
    Date: May 25th, 2010 at 3:32 pm

    thank y

  • Comment by Greg
    Date: June 27th, 2010 at 2:25 am

    Great plug-in, just what I was looking for as I didn’t want any emails say “wordpress”

  • Comment by Thiago Dias
    Date: August 12th, 2010 at 3:45 am

    thanx!

  • Comment by TomCap
    Date: September 6th, 2010 at 1:56 am

    Worked like a charm. Another little irritating item solved. Thanks!

  • Comment by Maira
    Date: January 21st, 2011 at 12:59 am

    worked. highly recommend. thank you!

  • Comment by oriflon
    Date: February 17th, 2011 at 11:49 pm

    how to edit manual?

  • Comment by SteveB
    Date: February 18th, 2011 at 12:20 am

    I loaded the plug in but can’t find it in the plugin list.

  • Comment by haohuu_lam_em
    Date: March 3rd, 2011 at 10:04 am

    Can not convert to UTF-8!

  • Comment by Demo Games
    Date: April 8th, 2011 at 9:20 am

    Thanks for sharing works fine on wordpress 3.1.1

  • Comment by I Shoot Reno
    Date: April 19th, 2011 at 9:23 pm

    Fantastic solution! Minimal effort needed to make this work from a novice’s standpoint!

Leave a Comment