July 16, 2015

WordPress Plugin – WP SpeedUp

WP SpeedUp

July 1, 2015

A WP Ghost adds code to .htaccess file!

I was working with .htaccess and whenever i change some apache headers in .htaccess so in a few moments some script was adding the following snippet again on EOF. It was a surprise for me that what type of ghost is there inside WordPress which has to check the “# END WordPress” and appends after […]

June 28, 2015

How to remove a directory which is not empty?

How to remove a directory which is not empty? function force_rmdir($dir) { if (is_dir($dir)) { $paths = scandir($dir); foreach ($paths as $path) { if ($path != “.” && $path != “..”) { if (filetype($dir.”/”.$path) == “dir”) force_rmdir($dir.”/”.$path); else unlink($dir.”/”.$path); } } reset($paths); rmdir($dir); } }

June 27, 2015

WordPress Plugin – WP Header Images

WP Header Images

June 23, 2015

How to apply a custom header image for each page in WordPress?

How to apply a custom header image for each page in WordPress with respect to the navigation menu bar? Here is the function: function get_parent_menu_id($id, $arr){ if($arr[$id]==0) return $id; else return get_parent_menu_id($arr[$id], $arr); } $arr = array(); $arr_obj = array(); $page_id = get_the_ID(); $menu_items = wp_get_nav_menu_items(‘Menu Main’); if(!empty($menu_items)){ foreach($menu_items as $items){ $parent = $items->menu_item_parent; $arr[$items->ID] […]

PHP function to check that you are main page?

define(‘LIVE’, (!in_array($_SERVER[‘HTTP_HOST’], array(‘localhost’, ‘wp-mechanic’)))); if(!function_exists(‘is_main’)){ function is_main(){ $uri = $_SERVER[‘REQUEST_URI’]; $arr = explode(‘/’, $uri); $arr = array_filter($arr, ‘strlen’); return ((!LIVE && (count($arr)==1)) || (LIVE && empty($arr)));//empty($uri) } }

June 16, 2015

Uploadify is not working in wp-admin as expected?

Solution is as follows: Go to initial state and don’t use any uploadify for now Try with default jquery, everything working fine Then use your plugin file as “enqueue” instead of linking files directly Enqueue one by one the js files Keep checking the conflicts Finally you will get it work, you are just missing […]

May 13, 2015

php function to get first letter of each word and make a unique key

A PHP helper function to arrange and rearrange randomly generate php array elements.