Hide “Gallery Settings” and “Insert into Post” button from Attachment window

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’);

Insert into Post button is missing for certain images

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

How to get clean code for a gallery?

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

How can I make wp default gallery responsive?

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

How to determine if a post has attached images?

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

Display latest 10 galleries

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

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