WP-Mix

A fresh mix of code snippets and tutorials

WordPress Shortcode for Linked Image Gallery

This cool little snippet was contributed by VRS from Russia. It enables you to display a set of linked gallery images. You can use this technique anywhere in your theme template file or in any WordPress Post or Page.

Display linked gallery in Post or Page

Add this shortcode to any WP Post or Page:

The trick to getting the linked images is the link attribute.

Display linked gallery in theme template

Add this snippet to your theme template:

<?php echo do_shortcode(''); ?>

Same basic idea, but here we are using do_shortcode() to output the shortcode via the theme template. Visit the WP Codex for more information about the gallery shortcode.

Thanks to VRS from Russia for the snippet.

Learn more

Digging Into WordPressWordPress Themes In DepthWizard’s SQL Recipes for WordPress