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

How to add a div around the default gallery output

Well, since you don’t want to edit core files (which is absolutely fine, and unnecessary) and also don’t want to do it by means of PHP (meaning functions.php, for instance), here’s a jQuery approach: $(‘div[id^=”galleryid-“]’).wrap(‘<div id=”SOME_ID” class=”SOME_CLASS” />’); BTW, you know there already is a container div that you can hijack for CSS purposes, right?

How to display some of images from media library?

You can use the get_posts to fetch attachments from the database. Here’s some sample code to get your started. You can put it inside any template file inside your theme. $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1 /* get them all */ ) ); if ( $attachments ) { foreach ( $attachments … Read more

Image thumbnails slider

I found the solution with cycle.js header.php <script type=”text/javascript” src=”http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js”></script> <script type=”text/javascript”> $(document).ready(function() { $(‘.slideshow’).cycle({ fx: ‘fade’, pause: 1, prev: ‘#prev’, next: ‘#next’ }); }); </script> single-photos.php <div id=”slideshowContainer”> <div class=”slideshow”> <?php the_content (); ?> </div> <ul id=”nav”> <li id=”prev”><a href=”#”></a></li> <li id=”next”><a href=”#”></a></li> </ul> </div>

zip download plugin works well in localhost but not on live site

As you can see, the code of the linked question add a custom gallery shortcode in this function: private final function __construct() { remove_shortcode( ‘gallery’ ); add_shortcode( ‘gallery’, array( __CLASS__, ‘gallery_zip_shortcode’ ) ); } and then this custom gallery shortcode is executed in this function: public static function gallery_zip_shortcode( $atts ) { $post = get_post(); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)