Usefull wordpress code snippets, hacks and tips

Prem Tiwari - - WordPress, WordPress Snippets

Today i have shared the most Usefull wordpress code snippets, hacks and tips. You can add these code snippets in your functions.php. As a WordPress developer i use very often the same snippets to avoid losing time when creating a new plugin. And today is great day just because i’m going to share some of them with you.

Display Custom Image Sizes in Admin Media Uploader

Add this code in your current theme’s function.php file.

Set Featured Image automatically

Use this code in function.php. Folow the below steps :

1) Select all posts
2) Get first attached images of the posts using get_children() function
3) Use the set_post_thumbnail() function to set the featured image for the posts.

Include the HTML code in widget

Copy and paste this code in function.php and then add html code in your widget.

Empty trash automatically

If you want to empty the trash automatically,then use this code in your wp-config.php.

Post thumbnail in RSS Feed

Add favicon image
Add this code in your function.php file.

Prem Tiwari

Prem Tiwari is the founder of and also a professional developer and a blogger by hobby.

Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.