How to remove the images from “Uploaded to this post”?

You have to unattach the images from the post. And that means setting their ‘post_parent’ => 0 in wp_posts database table. The plugin Unattach and Re-attach Media Attachments does exactly this, and it uses the following command to this end: $wpdb->update( $wpdb->posts, array( ‘post_parent’ => 0 ), array( ‘id’ => (int)$_REQUEST[‘post_id’], ‘post_type’ => ‘attachment’ ) … Read more

Display Gallery Images from Custom Post Type

You can alter the foreach loop as follows, foreach( $gallery[‘ids’] as $attachment_id ) { $image_attributes = wp_get_attachment_image_src( $attachment_id ); if( $image_attributes ) { $src = isset($image_attributes[0])? $image_attributes[0] : ”; if(!empty($src)) { ?> <a href=”https://wordpress.stackexchange.com/questions/118897/<?php echo $src; ?>” rel=”prettyPhoto[pp_gal]”><img src=”https://wordpress.stackexchange.com/questions/118897/<?php echo $src; ?>” alt=”Gallery image” /></a> <?php } } } You can specify required dimension, as … Read more

custom gallery filter with image caption as link title?

I found a working solution on the WordPress Forums. Here’s the code: function add_img_title_to_anchor($content) { /* Find internal links */ //Check the page for linked images $search=”/<a ([^>]*?)><img ([^>]*?)\/><\/a>/i”; preg_match_all( $search, $content, $matches, PREG_SET_ORDER); //Check which attachment is referenced foreach ($matches as $val) { // Only if the Link doesn’t already have a Title attribute, … Read more

Default WordPress gallery or very lightweight alternative to it?

I got the gallery working like I wanted to, using the following plugin: https://wordpress.org/plugins/rocket-responsive-gallery/ Also, if I will have time, I will apply the information in this article: http://ottopress.com/2011/photo-gallery-primer/ Furthermore: with this answer I no longer need the default WordPress gallery styles because I can customize the gallery myself. https://stackoverflow.com/questions/19802157/change-wordpress-default-gallery-output

WP Gallery showing captions twice

It looks like your WP Jquery Lightbox plugin is generating these extra captions. Check out the source of the jquery.lightbox.js file: … cut … var s=””; if (title != ”) { s=”<span id=”titleText”>” + title + ‘</span>’; } if (caption != ”) { if (title != ”){ s += ‘<br />’; } s += ‘<span … Read more

Possibilities for customising the standard wordpress gallery?

Gallery shortcode output is handled by gallery_shortcode function. If you look at the source code I linked you can udersand there are different way to customize the output: Using filters You can completely override gallery output using ‘post_gallery’ filter. Customize size via atts One of the argument you can pass to function using shortcode is … Read more

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