Since version 2.5, WordPress offers built-in galleries. I want to use this new functionality for:
Therefore, I have to do some modifications to Arun's The Morning After theme (that I am using here).
image.php
For using the new gallery functionality of WordPress 2.5, the theme needs a a new template file. This template file is called image.php. Due to the fact that The Morning After does not include the image.php template (yet), I have to create it by myself.
Therefore, I have copied image.php of the default theme into the directory of The Morning After and modified it so that it matches TMA.
The most relevant code is here:
For the full image.php template file, please click here
Thanks to Michael Fields, I was able to substitute the large thumbnails by text links. The text links nb_previous_image_link( '« Vorheriges Bild' ) and nb_next_image_link( 'Nächstes Bild »' ) require the following code in your functions.php:
For copy&paste, click here
home.php
For the "Latest Galleries" section on the starting page of this weblog, I am using the following code:
For copy&paste, click here
gallery.php
And for the gallery archive, I wrote the following page template:
For copy&paste, click here
Then, I have added the following variables to the style.css:
For copy&paste, click here
Conclusion
With these modifications, I ...
UPDATE! This version of the image.php is not compatible with WordPress 2.6. Please use the basic version without text link navigation or apply the fix that I have posted in the article about upgrading to WordPress 2.6.
Thanks for telling us. I’ll give it a try locally on my computer.
Hello,
It’s me again. I’m very impressed with your gravatar. Will you write tutorial of how to integrate it to your site?
Here you are:
The Morning After – Gravatars, anyone?
Hi Nick, I need some urgent help from you. I tried to do the above process and my WP is gone :( As soon as I copied the image.php and tried to move to the next page, I’m seeing only blank pages. You can see at http://ubiquitense.com/wp-admin. and also, my site doesn’t come up if I type http://ubiquitense.com
Thanks in advance!
well, I solved it myself…jus replaced the functions.php with the original one. phew!!! that was close :)
Ohh!!! Strange error… As you see on my site, I have no problems with the code!
Could you please forward me the functions.php to gigatech2006@gmail.com?
Danke!
You’ve got mail! Let me know if you still have problems..
I’ll tell you a solution without the functions.php then.
How do you say “you’re welcome” in Madras?
Hey Nick, I found this http://wordpress.org/extend/plugins/nextgen-gallery/, and ‘ve implemented it. It’s quite cool, and may be you wanna try it.
You can see it on my site http://ubiquitense.com/ and click on Gallery
Not bad. But I prefer a no further plug-in solution.
Does usage of plugins slow down the site? well, I found it attractive because ‘m not good at coding :)
Yes, some plug-ins do slow down the site.
But this is not the main reason why I say the less plug-ins the merrier.
My main reason is that I do not want to depend on plug-in authors when I upgrade my WordPress installation.
For example, NextGen Gallery was not compatible with WP 2.5 when the new version came out.
Oh yes, you’re right. Anyways, ‘m quite slow in upgrading to the latest WP versions..I just watch for more than a month and later upgrade when all plugins are ready for the new version :)
Ein weiteres Mal hat mir Deine The-Morning-After-Reihe sehr geholfen. Vielen Dank!
Momment: So wie es aussieht hast du einen Tippfehler in der home.php line:
img src=”/images/thumbs/
der slash zwischen dem “?” und dem “>” nach dem stylesheet muss weg.
Ein letzte Mal noch (es tut mir leid): Ich schaffs nicht, neuen Kram der Bilder-Kategorie aus den latest_post zu halten. Irgendeine Idee?
@fab:
I’ve exchanged the code with images… Arrghh… always have problems with displaying code.
About exlcuding the gallery category from LATEST POSTS, RECENT POSTS and the CATEGORY LIST, you have to:
php $catid3 = $wpdb->get_var(“SELECT term_ID FROM $wpdb->terms WHERE name=’GALLERY’”);
DONE.
Thank you very much! Problem fixed. I forgot the recent post section…
[...] Since version 2.5, WordPress supports built-in galleries. So, I have added a gallery archive, a gallery section on home.php and an image template to my customized version of THE MORNING AFTER. The tutorial can be read here. [...]
Nick,
Thanks for this. I have one question? How do I incorporate the gallery overview php file into a page? Or what do I need to do to set up the gallery overview page? I can’t seem to figure that out.
Do I create a page that incoporates the .php file?
Thanks
Nick,
Thanks for this. One question though? How do I set up the gallery overview page? I see how to create the .php file, but how do I incorporate that into a page? Everything else I can figure out, but that seems to lose me.
Hi Lee!
Ohh.. Sorry… Forgot to write about this…
Well, you upload the page template “gallery.php” into your TMA folder. Then, you “write a page” (all you need to do is inserting the title and applying the template to the page. click publish) and you are done.
Danke Nick! I learn something new everyday. Sorry about the double comment…didn’t realize the first one went through.
Hello Nick,
One more question, and I swear I’ll stop bugging you. Do you know how to change the variables to the thumbnails? I’d like them to be proportioned to the actual photo, not perfectly square. Where is the CSS for the actual pic thumbnails?
Thanks
Lee
Hi!
Go to:
WP Dashboard > Settings > Miscellaneousand deactivate “Crop thumbnail to exact dimensions (normally thumbnails are proportional)”
This change will only effect new uploads.
cheers
You’re My Hero
[...] the text-based navigation for your the image.php template that I have proposed in this tutorial is not compatible with WordPress [...]
Hello Nick
I love your customizations to the TMA theme and have been working with it to develop my site. I thought I mention that the gallery.php code on this page has an error which forces the galdescription box below the sample image. I found it was caused by an improperly named style – .set when it should be .galset – as shown below
<!–
<a href=”">
ID); ?>
–>
Thanks!
Thanks Nick, for sharing your codes and templates! Peace.