Category: Code Snippet

  • WordPress: Randomize posts in a category page

    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

  • WordPress Title Empty on Index Page

    WordPress Title Empty on Index Page

    Here’s description from WordPress Codex about what happen when WordPress title empty when viewing index page/ homepage If you are using a custom homepage with custom loops and stuff or a custom front-page, you will have an empty wp_title.

  • Responsive Ads with Google AdSense

    Responsive Ads with Google AdSense

    We could show Google AdSense responsively in our website with Responsive Ad Unit, this means we can control the size of the ads on our page corresponding to screen resolution of the visitor’s device. The code of Responsive Ad Unit detects the size of the screen and serve the appropriate ad unit that will best fit.

  • How to allow WordPress to upload Flash SWF files

    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

    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

    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 […]