June 30, 2015

JavaScript error td_mobile_menu is not defined

JavaScript error td_mobile_menu is not defined Solution: if (typeof td_mobile_menu == ‘function’) { td_mobile_menu(); }

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