Tag: code snippet
WordPress: Randomize posts in a category page
The following lines of code change the way of displaying posts in a category page from default to date to random order. Please add following lines of code to functions.php
How to allow WordPress to upload Flash SWF files
Some banner ads still use Flash SWF format, unfortunately Flash SWF is one of few format that has not been permitted in WordPress for security reason. WordPress generate error like this“Sorry, this file type is not permitted for security reasons.“ when we try to upload Flash SWF files in WordPress
WordPress: How to Hide Custom Field Meta Key from Custom Fields panel
I learned this trick when someone asked about How to Hide Custom Fields Meta Key from Custom Fields panel. This trick useful when you want to hide certain Custom Fields Meta Key and Value from client or authors Add following code to functions.php This code to hide a Custom Field Meta Key, just change mymetakey_no1…
WordPress: Add Title to IMG tag using Get The Image plugin
Get The Image plugin from Justin Tadlock is awesome, a script that can grab an image by custom field input, WordPress’ featured image, post attachment, or extracting it from the post’s content. Recently, someone asked about how to add Title to IMG tag. We know ALT attributes in IMG tag, but IMG tag also support…
WordPress: How to Display Date and Time with User-preferred Formatting
We set Date Format and Time Format in WordPress General Setting and we want to display that date on WordPress template. The Date Format and the Time Format settings allow us to set Date and Time to any format we wants, it also easier to use with localization. Use following code in WordPress template Date…
How to Modify get_comment_author_link to Open Comment Authors Website on new Window
By default, get_comment_author_link redirects the user to the site which was entered by comment author when they wrote comment in same window of our site. What if we want this to open on new window? Add following code to functions.php in your live theme directory