Gel all image from certain post type

Try this code in your template. $query = new WP_Query( array( ‘post_type’ => ‘custom-post’, ‘posts_per_page’ => -1 ) ); if( $query->have_posts() ){ while($query->have_posts()){ $query->the_post(); $image_query = new WP_Query( array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘inherit’, ‘post_mime_type’ => ‘image’, ‘posts_per_page’ => -1, ‘post_parent’ => get_the_ID() ) ); while( $image_query->have_posts() ) { $image_query->the_post(); echo wp_get_attachment_image( get_the_ID() ); … Read more

How can I make all gallery images to open in a new window?

(Update 04.05.2012: Include captions) Let’s start with a solution … There is no filter especially for gallery image links. There is also no filter for the gallery shortcode output. So we have to fake one: add_action( ‘after_setup_theme’, ‘wpse_50911_replace_img_shortcodes’ ); /** * Replace the default shortcode handlers. * * @return void */ function wpse_50911_replace_img_shortcodes() { remove_shortcode( … Read more

How to remove title attribute from gallery links and images

I’ve found a solution : // Remove <img> title attribute in // http://wordpress.org/support/topic/wp_get_attachment_image_attributes-filter-not-working function remove_img_title($atts) { unset($atts[‘title’]); return $atts; } add_filter(‘wp_get_attachment_image_attributes’,’remove_img_title’, 10, 4); // remove title attribute from <a> title attribute in // modified from this post : http://oikos.org.uk/2011/09/tech-notes-using-resized-images-in-wordpress-galleries-and-lightboxes/ function ah_get_attachment_link_filter( $content ) { $new_content = preg_replace(‘/title=\'(.*?)\”https://wordpress.stackexchange.com/”, ”, $content ); return $new_content; } add_filter(‘wp_get_attachment_link’, ‘ah_get_attachment_link_filter’, … Read more

How to insert Gallery shortcode to a meta box

That is a weird way to do it, shortcodes are really meant for inserting into the editor, if you want to program some functionality it’s better to go straight into the template/code itself. //check if post format is gallery type if ( has_post_format( ‘gallery’ ) { echo do_shortcode(”); }

Setting up a gallery with images and a zip download

You can use the built-in functionality to solve this: The WordPress Gallery. Each post and page (and normally custom types) can have files of all kind attached to it. You upload them through the Add Media button, and have the option to make a Gallery with the images attached to this post/page or with other … Read more

Images Missing from built in WP Gallery

You have a limit inside an script and you should change some values to adapt your needs: jQuery…. //user settings var thumbsPerPage = 15; var maxPaginatedLinks = 200; var hideEffect = “drop”; var showEffect = “drop”; var effectSpeed = “slow”; var count = 1; //handles multiple galleries on page var galleryCount = $( “[id^=gallery-]” ).each( … Read more

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