How do i show wordpress attachments from current post?

Your code and description seem to refer to the previous/next attachment navigation. That code is intended to display previous/next attachment navigation, and that’s exactly what it’s doing. If you want to display all attachments: Within the Post Content, use the shortcode Programmatically, in the template file, use e.g. get_posts(), combined with e.g. wp_get_attachment_image(): <?php global … Read more

Photo gallery with Featured Images

$query = new WP_Query(array(‘posts_per_page’ => 6, ‘meta_key’ => ‘_thumbnail_id’)); while($query->have_posts()) : $query->the_post(); the_post_thumbnail(); endwhile; This code gets 6 latest posts which have featured image available & show those 6 images on the page. It will skip those posts where there is no featured image set even if they are newer. This will probably get you … Read more

If no featured image is set, default.png from core is shown

here’s the wp_get_attachment_image_scr function: function wp_get_attachment_image_src($attachment_id, $size=”thumbnail”, $icon = false) { // get a thumbnail or intermediate image if there is one if ( $image = image_downsize($attachment_id, $size) ) return $image; $src = false; if ( $icon && $src = wp_mime_type_icon($attachment_id) ) { /** This filter is documented in wp-includes/post.php */ $icon_dir = apply_filters( ‘icon_dir’, … Read more

the_post_thumbnail ignores size parameter

WordPress uses min( intval($content_width), $max_width ) inside image_constrain_size_for_editor for large image size. As I can see your $content_width is set to 660. So, change the $content_width in your functions.php file to the 1024 or whatever you need. For full-width layout, it’s better to remove it. Example: $GLOBALS[‘content_width’] = 1600. That’s it. If you don’t know … Read more

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