Gallery Only Displaying One Thumbnail

Try this and verify that the attachments come back correctly when queried directly: // helper function to return first regex match function get_match( $regex, $content ) { preg_match($regex, $content, $matches); return $matches[1]; } // Extract the shortcode arguments from the $post $shortcode_args = shortcode_parse_atts(get_match(‘/\[gallery\s(.*)\]/isU’, $post->post_content)); // get the attachments specified in the “ids” shortcode argument … Read more

Attach custom gallery to a page

You can upload images in media of each page by using INSER GALLERY button.You can Upload multiple images & galleries also. You can get all images of each page by using below code. $images = get_posts( array( ‘numberposts’ => -1, ‘post_parent’ => $post->ID, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, … Read more

how do i embed the pdf gallery in wordpress post

You can use the Custom URL field, to modify the attachment link for each one of your gallery images: where this is supported by the following plugin: <?php /** * Plugin Name: Custom Attachments Links * Description: Adds a new media field, to override the default attachment links. * Plugin URI: http://wordpress.stackexchange.com/a/176668/26350 * Plugin Author: … 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)