wordpress snippets last updated   : April 22, 2014
we now have 631 snippets

Post Meta.. How do I save it?

tutorials
post-meta-save-how-to

In the last article,we talked about post meta from a high-level, explaining what it is, and how it’s presented in WordPress, and most importantly, how to use get_post_meta to retrieve that data.

read more

Add custom image sizes to media insert dialog box with image_size_names_choose

wordpress snippet

With this little snippet you can add custom image sizes to media insert dialog box. image_size_names_choose allows modification of the image size lists so that you can place a custom option within the media library.

read more

What is Post Meta? An intro to WordPress Custom Fields

tutorials
post-meta-intro-wordpress-custom-fields

Here on wpsnipp, we post a lot of snippets revolving around post meta. You’ve undoubtably seen snippets with function calls like get_post_meta( $post_id, $meta_key, true ) or update_post_meta( $post_id, $meta_key, $new_value ), but you may not understand what WordPress is actually doing.

read more

Require a featured image before you can publish post

wordpress snippet
require-featured-image-can-publish-post

    If you would like to require that all posts have a featured image before they can be published add this snippet to the functions.php of your wordpress theme. When you try and publish a post without a featured image you get an admin message “You must select Featured Image. Your Post is saved but it can not be published.” Great way to ensure all your posts have a featured image before they are publish.

    read more

    Require minimum comment length in wordpress

    wordpress snippet
    wordpress-require-minimum-comment-length

      Add this great snippet by Paul Underwood to the functions.php of your wordpress theme and require a minimum comment length. Anything under the limit will return an error message using wp_die “All comments must be at least 20 characters long.”

      read more

      Stop Disqus from outputting JS on anything but single posts or pages

      wordpress snippet

      Disqus outputting JS on parts of your wordpress website you don’t want? Adding this snippet to the functions.php of your wordpress theme will only output JS on is_singular posts or pages where comments are available.

      read more
      jqsnipp.com | we just launched jquery snippets website