How do I test whether [gallery] is empty?

You can check if an attachment for the given post exists with the get_posts function. This will create a new sql query – so there could be a performance issue. // Util.class.php class Util { public static function has_attachments() { $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => null, ‘post_parent’ => $post->ID … Read more

Gallery – custom html for inserting images

In cleaner-gallery.php make changes to the cleaner_gallery_plugin_gallery_image function that starts on line 122 and ends on line 151. What we are doing is replacing href with data-href in the two instances that output the html with the image attributes. function cleaner_gallery_plugin_gallery_image( $image, $id, $attr, $instance ) { /* If the image should link to nothing, … Read more

A proper gallery in wordpress?

WordPress can do a lot with images provided it’s configured right, and exactly how you want it. http://ottopress.com/2011/photo-gallery-primer/ will give you the basics to then customise to your requirements. A great example of this kind of thing can be seen on Matt Mullenweg’s site: http://ma.tt/gallery/

Workflow for users to download files?

Try adding this to your theme’s functions.php file function Get_curPageURL() { $pageURL = ‘http’; if ($_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;} $pageURL .= “://”; if ($_SERVER[“SERVER_PORT”] != “80”) { $pageURL .= $_SERVER[“SERVER_NAME”].”:”.$_SERVER[“SERVER_PORT”].$_SERVER[“REQUEST_URI”]; } else { $pageURL .= $_SERVER[“SERVER_NAME”].$_SERVER[“REQUEST_URI”]; } return $pageURL; } add_filter(‘gettext’,’custom_login_to_download_msg’); function custom_login_to_download_msg( $input ) { if( !is_admin() && ‘You must be logged … Read more

Get the a specific image from the post gallery linked to post_id

You can get all the images associated with a post with the following: $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘post_parent’ => $post_parent_id // you’ll need to set this somewhere else ); $images = get_children( $args ) To go from that to the 2nd image, you should just need to point to $images[1], … Read more

Slideshow with thumbnails

You can create thumbnails with jQuery Cycle plugin in WordPress by following the example located HERE Example: $(‘#slideshow’).before(‘<ul id=”nav”>’).cycle({ fx: ‘turnDown’, speed: ‘fast’, timeout: 0, pager: ‘#nav’, // callback fn that creates a thumbnail to use as pager anchor pagerAnchorBuilder: function(idx, slide) { return ‘<li><a href=”#”><img src=”‘ + slide.src + ‘” width=”50″ height=”50″ /></a></li>’; } … Read more