Can I attach an image to a different post?
This works for me: http://wordpress.org/support/topic/detach-amp-re-attach-media-attachment-images-from-posts#post-1609173 I’ve saved this as a snippet in my IDE for use in projects. Very handy!
This works for me: http://wordpress.org/support/topic/detach-amp-re-attach-media-attachment-images-from-posts#post-1609173 I’ve saved this as a snippet in my IDE for use in projects. Very handy!
i had sort out this with function get_post_gallery find the answer if ( ! function_exists( ‘flexi_gallery_slideshow’ ) ) : /** * Display an optional post read more link * */ function flexi_gallery_slideshow( ) { echo ‘<ul class=”bxslider”>’; if ( get_post_gallery() ) : $gallery = get_post_gallery( get_the_ID(), false ); /* Loop through all the image and … Read more
A little background: WP stores the attachments in the same database table as posts. Therefore the table rows correspond to the fields of the media edit modal: get_post_gallery_images will return you URLs to the images, but not the actual data in the database. You could do a reverse-query and look for posts that contain the … Read more
it seems to me, after going through the source codes (both PHP and JS), that gallery and it’s order is not saved to database at all. Gallery exists only in JS when you are creating that and even does not persist when you leave a post editing page. Gallery gets saved only by inserting gallery … Read more
While researching I found what may be a duplicate, but I’m really not sure, as this one deals with sending the value somewhere else… There, I learned that there’s a plugin for what I was already coding ( Multiple Galleries) and it injects the include attribute when inserting the gallery. Nonetheless, a worthy exercise and … Read more
Gallery with the same caption to all images: Here are two different ways to achieve this dynamically, without editing the caption for each image in the gallery. If we use the custom attribute same_caption in our gallery shortcode: then we can get the same caption for that gallery. Before: After: This is independently supported by … Read more
First thing is first… you can use a mobile plugin to create a website especially for mobile users. I usally use WPtouch To check if a user is using a mobile browser / agent you can also use a function… that means you would need to update user agents from time to time… Here is … Read more
UPDATE I’ve just submitted a core patch to add link=”none” support to the shortcode. ORIGINAL ANSWER You don’t need to hack core to do what you want to do; just use the appropriate shortcode parameters, e.g.: If you want to change the defaults, then use the post_gallery filter: function mytheme_gallery_shortcode_defaults( $output, $attr ) { global … Read more
Instead of using 2 separate functions to grab the attachment you can use the same function, and then add the URL in separately using wp_get_attachment_url, making the logic much clearer, and reducing the amount of work needed: e.g. $image = wp_get_attachment_image( $id, $size, false ); // if it’s set to not show the image link … Read more
If you want get_post_gallery_images to give you full size images, you can use the following: // Use full size gallery images for the next gallery shortcode: add_filter( ‘shortcode_atts_gallery’, ‘wpse_141896_shortcode_atts_gallery’ ); // Your code: $gallery = get_post_gallery_images( $post ); foreach ($gallery as $img) { ?> <li><img src=”https://wordpress.stackexchange.com/questions/141896/<?php echo $img; ?>” /></li> <?php } where /** * … Read more