Connect with us

WordPress Coding & Design

WordPress Gallery and EXIF



The release of WordPress 2.5 included a built in gallery feature. Nothing major by any means, but it gave you the option of using a simple gallery to display your photos. It also included the ability to pull the EXIF data from your photos. However, whilst the features are there, there’s not much information or tutorials on using them. Hopefully this post will give you a bit more information on how to get the most from this new feature.

Create the Gallery

You can create the gallery in a post or a page. If you want to create a collection of galleries then you need to decide whether you’re going to use a static Page as the page parent, and then for each gallery you create a child page. Alternatively, you can create a Gallery category and then each gallery is a post within this category. Either method is fine, but for this example I’ll assume you’re going the post route.

So, you’ve got your category called Gallery (or whatever you wish to call in). Create a new post, giving it a title as usual. You can add in some content too if you like. Then click on the ‘Add an Image’ button by Add media in the top right of the post area. A popup should appear allowing you to upload your photos. You can do them individually or several at a time (note you may need to change the file permissions on your wp-content/uploads folder for this to work). Once they’ve uploaded, click on the Gallery tab at the top of the box. You can then go through each photo by clicking the Show link, and give each photo a title, caption and description. Once you’re done, click Save all Changes. Then click ‘Insert Gallery into Post’.

Your post will now have the gallery shortcode placed where the cursor was – [gallery]. You can easily move this if necessary. The gallery shortcode can accept a few options/parameters:

Specifies how many columns the gallery should span. The default is 3.
Controls which size to display on the gallery page. The default is thumbnail, the options are thumbnail, medium and full.

Other options can be read about on the Gallery Shortcode codex page. To use these options you add them into the gallery shortcode eg.

[gallery columns="2" size="medium"]

Once you save this post and view it you should see the selected size photo for each photo uploaded, laid out in a simple gallery format, with the caption below each image. Clicking on the image opens up the medium version of the image and displays the image title above the image and the description given below it. This single image display page uses the single.php theme file. You can also use image.php or application.php, however I found the image disappeared with these!

To control the size of the thumbnail and medium size images go to Settings -> Miscellaneous in the WordPress Admin and change the values for the images there.

The EXIF Data

When you upload your photos the EXIF data is stored in the post meta data table. Information on how to extract this and display it is very thin on the ground, so if there's a better method feel free to leave a comment, however the following works and should be futureproof.

To extract the complete field into a variable (which will then store as an associative, multi dimensional array) we use the following line of code within the loop (ideally perhaps after the_content() tag)

$imgmeta = wp_get_attachment_metadata( $id );

The $id is the attachment ID and is created by the loop so this is already set. There is a variety of data that you can then echo out:

The width of the original photo uploaded.
The height of the original photo uploaded.
The aperture used.
The person credited for taking the photo.
The camera used.
The timestamp of when the photo was taken.
The copyright on the photo.
The focal length used in mm.
The ISO used
The shutter speed used in seconds.
The title given to the photo.
The caption given to the photo.

Some of this data will not be available without it being added via a program such as Photoshop. Other additional data may be available depending on your camera’s settings (I’ll continue to add to this list as I find more details available).

So we can take what we want from this data and display it with the photo. A couple of items will need formatting, for example the timestamp is in seconds so we need to convert it to a normal date and time using PHP, and the shutter speed will need rounding off to a couple of decimal places. We also only want this displayed if we’re displaying an image. So a final list could look like

[sourcecode language=”php”]< ?php if (is_attachment()) : $imgmeta = wp_get_attachment_metadata( $id ); echo "

    echo “

  • Dimensions: ” . $imgmeta[‘width’].” x “.$imgmeta[‘height’].”
  • \n”;
    echo “

  • Aperture: f/” . $imgmeta[‘image_meta’][‘aperture’].”
  • \n”;
    echo “

  • Camera: ” . $imgmeta[‘image_meta’][‘camera’].”
  • \n”;
    echo “

  • Date Taken: ” . date(“d-m-Y H:i”, $imgmeta[‘image_meta’][‘created_timestamp’]).”
  • \n”;
    echo “

  • Copyright: ” . $imgmeta[‘image_meta’][‘copyright’].”
  • \n”;
    echo “

  • Focal Length: ” . $imgmeta[‘image_meta’][‘focal_length’].”mm
  • \n”;
    echo “

  • ISO: ” . $imgmeta[‘image_meta’][‘iso’].”
  • \n”;
    echo “

  • Shutter Speed: ” . number_format($imgmeta[‘image_meta’][‘shutter_speed’],2).” seconds
  • \n”;
    echo “”;

    For US format for the timestamp use the following:

    [sourcecode language=”php”]echo “

  • Date Taken: ” . date(“m-d-Y H:i”, $imgmeta[‘image_meta’][‘created_timestamp’]).”
  • \n”;[/sourcecode]

    For more options for this see the PHP Date reference.


    This new feature should allow you to use WordPress as a standalone photo gallery or as part of a bigger site, without the need for plugins. Of course the various photo gallery plugins out there will give you a lot more options, but with a bit of thought, this gallery can be quite powerful. Using the post method means your galleries index is automatically updated with the latest gallery at the top, just like a usual blog category and blog post format.

    The best (and really only) use I’ve seen of this new feature is from Matt Mullenweg’s Gallery. Whether he’s manually put in the photo count, used a bit of PHP to query the number of images in the gallery (perhaps there’s a template tag for that which I’ve not come across yet?), or it’s a potential future feature, who knows. But it’s a nice use and goes to show the potential for what this gallery has.

    (Code not working? Be sure to remove the additional space between the <? and php. It’s added by the code plugin unfortunately)

A PHP Developer using WordPress to power both blogging and commercial CMS sites. I've written and released a couple of plugins for WordPress and am currently writing plugins for use on commercial websites.

Continue Reading

WordPress Coding & Design

Will Artificial Design Intelligence Takeover Web Designing and Development?



Artificial Design Intelligence

The worlds are colliding.

Web designing and development happens in two primary ways:

  1. DIY (bloggers and small business owners buying readymade themes, web hosting account, and setting up the website after reading a lot of online resources)
  2. Agencies (dedicated agencies that create websites from scratch, using manual coding and templates, and these are usually high budget)

There is a third way, which in the next couple of years can replace both the above methods to a large extent. Will it? Let’s see.

Artificial Design Intelligence

Artificial Design Intelligence (ADI) is the ‘third’ way wherein companies are creating technology where a website could design and build itself. In 2003, prior to ADI, Adobe unveiled its suite of web designing tools and the industry experts spelled it as a doomsday for designers.

Will this ADI technology completely eradicate the need for website designers and developers? Certainly not, says David Kosmayer from Bookmark. Bookmark is a website builder that uses ADI to cater to each user’s specific and unique needs. Kosmayer opines that ADI technology will become a productivity tool for innovative developers and designers where the technology will improve and escalate the efforts of the team involved in automating the website development process. He is anticipating a website building ADI revolution with Bookmark, thriving to be at the forefront of this inevitable movement.

David gave me an insider peek into the ADI technology they are developing, scheduled to release in the next couple of weeks. Here it is:

The ADI technology improves possibilities.

I create my own websites and blogs. Now, if I have access to technology that Bookmark is designing, it will simplify my work. It’s unassumingly perfect for eCommerce stores. The ADI asks what kind of store does the user want – from a Bistro to a Laundromat, the user has tons of varieties. Once the basic is uploaded, you can add Focus Groups and Modules, and make the site live.

This ADI technology is akin to a personal assistant that understands my business needs and creates a customized ‘product’ to use.

After Bookmark, companies like Wix and TheGrid have ventured into the AI technology space too.

AI for website development and designing is an uncharted area. Chris Lema has a brilliant article title, Has Website AI Arrived?

The world of content marketing should rejoice. AI technology will strategically and dynamically depend on content to design the layout of the site. Here, content could be anything – article length, article quantity, images, videos and more.

Artificial design intelligence is still in nascent stages.

Who could use ADI technology? Bloggers, digital marketers, affiliate marketers, consultants, and other small business owners will find AI entertaining and useful. This group of professionals is usually a one-man army with a small remote team. It cuts down cost on resources as users will probably use the ADI service on a monthly subscription basis. As such, businesses can focus on branding and generating revenue.

The stress of creating dynamic websites, learning technology, and implementing them is removed entirely.

Personally, I agree with Lema that AI technology for website development and designing is yet to mature. With the coming of chatbots and other AI software, give this a year or two before the artificial design intelligence technology for websites booms.

Continue Reading

WordPress Coding & Design

How to Stop Comment Spam in 60 seconds with CleanTalk



Blog comments can be one of the most valuable assets to your blog, but they can also be a huge burden at the same time. Even with Akismet installed on my blogs, I still have to manually go through and remove the junk and spam comments many of my sites gets on a daily basis.

When I login to my WordPress dashboard, I will continually junk like this just sitting there and waiting for my approval or deletion. The majority of comment spam happens because they are trying to get a backlink to a site, either through a link within the comment or from the username.


If you have a small WordPress site, you might not be getting overwhelmed with spam comments yet, but it’s simply just a matter of time. The worse part is that it’s pretty much all coming in on an automated basis, which means cleaning up your spam comments manually can waste endless hours of your valuable time.

Comment spam is something all bloggers have to deal with, and while there are ways to minimize worthless and fake comments with plugins like Akismet or using CAPTCHA forms, these methods either don’t work or are just too annoying to setup. felt the same way and they wanted to create a comment spam solution that works for all blog site owners, while also having a solution that actually works.

How CleanTalk WordPress Spam Plugins Works

Like most things in the world, you just want the product or service to work and not have to deal with the complexities of how it’s made. This is how most online marketers and bloggers feel — they just want a solution and not have to deal with coding, programming and working with a dev team to figure it out.

CleanTalk is quite advanced on the backend, but super easy to setup and use from a site owner perspective. Through it’s cloud based platform, CleanTalk actively monitors the visitors on your site and makes sure the comments being made, are from actual visitors (not spam bots).

The process of how CleanTalk works, is as follows:

  1. A visitor writes a comment or registers.
  2. CleanTalk plugin sends action parameters into the CleanTalk cloud.
  3. Service analyzes the parameters.
  4. If this is a visitor, the comment will be published. If it’s a spam bot, then CleanTalk blocks this comment or registering.
  5. Parameters are written to the log which can be viewed in the Control Panel service.

Not only does CleanTalk protect your blog comment area, it also covers all forms throughout your site (contact, registrations, etc). When logged into your account through their site, you will also have access to real-time stats on how well it’s protecting your site and showing you what activity is happening where.

How to Install CleanTalk on WordPress

Since CleanTalk is a WordPress plugin, it’s super easy to setup. All you need to do is visit their main site at, create an account and grab your access key on the following page.

After that, all you need to do is head over to your WordPress dashboard, go to the “Plugins” section and search for “CleanTalk”.

CleanTalk Installation

Install the plugin and then throw in your access key and you are ready to go!


To make sure the plugin is properly installed and running, go back to your blog and complete a dummy comment, registration or contact message with the email address and you should then see the plugin react with the message like the one in the screenshot below.


You can also head back to the main dashboard at to monitor your site comment stats and manage how many sites you would like to add the plugin to.

Get Your Free 14 Day Trial of CleanTalk

You can register on the site and install the plugin right away. After completing this step, you will have 14 days of free access to their comment spam blocking service. After the 14 days, you will then have the renew your account.

The good news is that the cost of CleanTalk’s comment spam blocking plugin is just $8 per year, and you can save even more by using coupon code “BLOGGINGTIPS“.

Head over to, create your free account and add the plugin to your site. It’s only takes a couple minutes and it will save you a massive amount of time in the long run. Eliminate comment spam from your site forever!

Continue Reading

WordPress Coding & Design

The Importance of Responsive Web Design



Responsive web design is quickly changing how sites are viewed on the internet and on mobile devices. Back when I first started making money online in the mid 90s, everything was so basic and simple with web design… it was pretty much all HTML.

Then in 2007 I started using WordPress to create my first blog and the rest of my sites there after.

However, this was only the beginning. Now with everyone so focused on using mobile and other various devices to browse the internet and with the wide range of desktop sizes for viewing, it’s now more important than ever to make sure you have a site that is capable with all solutions.

I still find it amazing that I can look up sites on my phone or iPad and still come across sites that aren’t mobile optimized or that don’t load correctly. It’s quite a shame and something that really needs to be fixed immediately. Statistics show that 25% of internet users only access the internet via a mobile device. Have you checked how your site loads on a mobile device lately? If not, it might be time for you to invest some resources into your web design and development. By working alongside a respectable design team, they will be able to improve the performance of your site, while making sure it is fully optimized in the process.

Thus bringing us to responsive web design

Responsive web design refers to a website designed to adapt to whatever device a visitor is using. The same applies for desktop viewing as well. You can make the browser bigger or smaller and the content on the site will continue to adapt to your viewing solution.

Most premium wordpress themes are now responsive as well, as it’s almost become a requirement for site owners now.

When it comes to designing and coding wordpress themes, I’m the last guy that wants to deal with these issues. Fortunately there are designers and teams dedicated to mastering the art of design and wordpress.

For those of you who are wondering how responsive sites are created and the various tech specs involved, be sure to check out the infographic below from

What is Responsive Web Design

Continue Reading