wordpress snippets last updated   : April 14, 2014
we now have 630 snippets

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

      Add body_class to page templates in wordpress

      wordpress snippet

      Adding this snippet to the functions.php of your wordpress theme will let you add a body_class based on a specific page template.

      read more

      Use wp_trim_words to trim your text in wordpress

      wordpress snippet

      WordPress 3.3+ has a core function called wp_trim_words() this function will trim text to a specified number of words and return the result. Adding this snippet to your wordpress loop will let you easily trim the number of words displayed within the_content, the_excerpt, the_title or any other value you pass to this core function.

      read more

      Attach PDF files to post with custom metabox file selection

      wordpress snippet

      Adding this snippet to the functions.php of your wordpress theme will create a new metabox within your post editing screen with a select menu listing all PDF files. Adding the second snippet in your wordpress template in the location you wish to display the files URL.

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