Tag Info

Hot answers tagged

5

If you're comfortable with the complete opposite of the linked answer, you simply could use this query to fetch all posts that have an attachment and then use their IDs as the post__not_in parameter of \WP_Query: $attachment_args = array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'inherit', ...


3

I got curious about the SQL way of finding all posts without any attachments. Method #1 - Sub query with NOT IN Here's my first attempt to construct such a query: global $wpdb; $sql = " SELECT p1.ID, p1.post_title FROM {$wpdb->posts} p1 WHERE p1.post_type = 'post' AND p1.post_status = 'publish' ...


2

The gallery_shortcode with its default styles can be found in wp-includes/media.php line 906 to 1089. There is also an article in the codex that might be useful: Gallery Shortcode. There is also a couple of filters available as you can see from the source code that you can use The gallery shortcode uses the default thumbnail size, which is 150 x 150 px. ...


1

Depending on how your Galleria plugin is interacting with the attachment image filters, you should be able to inject your data attribute using the wp_get_attachment_image_attributes filter. Obviously, the attribute would be added for anything using wp_get_attachment_image(), but it will do what you're asking. /** * Filter attributes for the current ...



Only top voted, non community-wiki answers of a minimum length are eligible