Image limit from 1 to 5

I haven’t tested this but I believe you would simply change some of the code close to the end of the snippet you posted. if (count(get_posts(“post_type=attachment&post_parent={$post_id}”))>5) $file[‘error’] = “Sorry, you cannot upload more than five (5) images.”; Let me know if this doesn’t address your needs.

How do I get resized thumbnails?

Your example code is calling the full size image as you mention and resizing to the dimensions you feed into the array. I’ve answered this question before here, but the basic idea is that you’ll want to use add_image_size() in your functions.php to tell WordPress you’d like it to create a new image size when … Read more

Creating image gallery in wordpress

why not to use a plugin like nextgen-gallery? You can ask the plugin to scan a dir to build a gallery, then are many possibilities to display the images. If this cannot be a solution you need to access via php directly the filesystem, not difficult but some work needed 😉

Images with excerpt function

For everyone that is looking for an excerpt that keeps images etc in tact without using the first image function, here is the code function pietergoosen_custom_wp_trim_excerpt($text) { global $post; $raw_excerpt = $text; if ( ” == $text ) { $text = get_the_content(”); $text = strip_shortcodes( $text ); $text = apply_filters(‘the_content’, $text); $text = str_replace(‘]]>’, ‘]]>’, … Read more