show other images from same gallery
At it’s very simplest, add this to your theme’s attachment.php <?php do_shortcode(”); ?>
At it’s very simplest, add this to your theme’s attachment.php <?php do_shortcode(”); ?>
If you actually wanted to remove it instead of just hiding it you could remove the ‘admin-gallery’ script that is used to insert the gallery settings form. And if you wanted it to be remove only for non-admins then something like this should work: function disable_wp_gallery() { if( !current_user_can(‘manage_options’) ) wp_deregister_script(‘admin-gallery’); } add_action(‘admin_enqueue_scripts’, ‘disable_wp_gallery’);
If you have a post type that doesn’t have the editor, uploading media in that post type will cause it to not have an “Insert into Post” button. Not sure if that’s your situation, but personal experience says that could be the reason 🙂 I would definitely disable all plugins and switch to a default … Read more
If you think your shortcode is hurting performance (measure and you will know!), then you might want to consider caching its output in a transient. A good way to get a unique key would be to consider what could differentiate calls to your shortcode function: its name the attributes passed the site URL (in cases … Read more
I have the Same issue, its a bug in 3.5.1 You have to select “Attachement page” from the dropdown menu, then go back to “Media file”.. This will add gallery link=”file” ids= to your script (which is missing)
Recently I’m using this workflow: Register a custom taxonomy for attachments Use some code to add the feature of mass assign taxonomy terms to uploaded images (Because I do these 2 tasks frequently I’ve created a plugin that implement them and more see here) Create in a plugin a shorcode that looks like [gallery_term tag=”landscapes, … Read more
You can try to overwrite the gallery shortcode with: add_shortcode( ‘gallery’, ‘custom_gallery_shortcode’ ); where the shortcode callback is: /** * Overwrite the native shortcode, to modify the HTML layout. */ function custom_gallery_shortcode( $attr = array(), $content=”” ) { $attr[‘itemtag’] = “li”; $attr[‘icontag’] = “”; $attr[‘captiontag’] = “p”; // Run the native gallery shortcode callback: $html … Read more
You can try using css to control the visual layout. I have tested on my dev server and this was successful. @media only screen and ( max-width: 320px ) { .gallery-item {float:left;width:50% !important;} } what we have done is set the column to 50% the total container width when viewing on devices smaller then 320px. … Read more
You could use get_posts and search for image attachments. <?php $images = get_posts(array( ‘post_parent’ => $the_parent_to_check, // whatever this is ‘post_type’ => ‘attachment’, // attachments ‘post_mime_type’ => ‘image’, // only image attachments ‘post_status’ => ‘inherit’, // attachments have this status )); if($images) { // has images } else { // no images. 🙁 } Might … Read more
Getting the latest posts with a gallery is simple: search for posts with the string ‘[gallery’. $posts = get_posts( array ( ‘s’ => ‘[gallery’ ) ); Getting the first image from each gallery is harder, because you have to render the gallery shortcode. I would not use the default handler, it does much more than … Read more