Snippets »

Kill WordPress execution

Kill WordPress execution

ThinkWP October 16, 2011

wp_die kills the WordPress execution and display HTML message with error message. A call to this function complements the die() PHP function. The difference is that HTML will be displayed to the user. It

Read More »
Create WordPress post with a php function

Create WordPress post with a php function

ThinkWP October 16, 2011

This function inserts posts pages and custom post types in the database. It sanitizes variables, does some checks, fills in missing variables like date/time, etc. very handy when you need to create and insert

Read More »
WordPress Human Time

WordPress Human Time

ThinkWP October 16, 2011

human_time_diff( $from, $to ) A feature to mimic twitter like time display. Instead of outputting the time in a basic format you can display it like this: Admin posted 7 hours ago http://codex.wordpress.org/Function_Reference/human_time_diff

Read More »
WordPress Cron Jobs Function

WordPress Cron Jobs Function

ThinkWP October 16, 2011

Schedules a hook which will be executed by the WordPress actions core on a specific interval, specified by you. The action will trigger when someone visits your WordPress site, if the scheduled time has

Read More »
Display author Gravatar in the loop

Display author Gravatar in the loop

ThinkWP October 13, 2011

If you want to display an author’s Gravatar, this little code should do the trick (note that it only works inside the Loop): <?php echo get_avatar( get_the_author_meta('user_email'), 48 ); ?> The second parameter dictates

Read More »
Remove Admin bar from WordPress 3.1+

Remove Admin bar from WordPress 3.1+

ThinkWP October 13, 2011

WordPress 3.1 comes out with a new function called Admin Bar. This bar is added to your site (both on the dashboard and the site itself) if you’re logged in. Want to remove it?

Read More »
Update WordPress easily without writing FTP Info

Update WordPress easily without writing FTP Info

ThinkWP October 12, 2011

If WordPress asks you your FTP host, username and password each time you’re trying to upgrade, you should eaither check your file permissions or use this very useful hack which will make WordPress remember

Read More »
Display thumbnail from Youtube with Shortcode

Display thumbnail from Youtube with Shortcode

ThinkWP October 12, 2011

First, you need to create the shortcode. To do so, copy the code below and paste it into your functions.php file. /* Shortcode to display youtube thumbnail on your wordpress blog. Usage: [youtube_thumb id="ID"

Read More »
Bash Script for WordPress Install

Bash Script for WordPress Install

ThinkWP October 12, 2011

A simple bash function to add to your .bash_profile for those of you who are lazy/don’t like using a mouse. It will download the latest and freshest version of WordPress for your new project

Read More »