Create a custom post type and its metaboxes

In WordPress everything is a post_type and anything you would like to attach with this post_type is possible by metaboxes. Posts are stored in the wp_post table and its meta information is stored in wp_postmeta table. This is a very basic structure which WordPress follows and every new collection is build around it. posts and …

Search a keyword in a directory using terminal

Hi fellows this is a very important command for a programmer and a terminal user. You don’t know where a function can be made within a project So this terminal command provides you the access to search within a directory. grep -r “newness” /home/shakalya/Desktop/swimnchill/twentyeleven I am searching ‘newness’ in the whole twentyeleven directory. You can …

Fix the CDN missing images for your SSL site

If you ever find such a problem that not all of you files get uploaded in CDN. You know you can migrate images but it takes some time there is not a full surety that all images will be uploaded to CDN. So If you put a CDN link like db79e2070b0c95965a69-f4ee703189c46af6fe45f026a70dab33.ssl.cf2.rackcdn.com will not found missing …

Add WordPress pagination with a custom function

1. Here is the pagination Code. Put it directly to the function.php at the theme directory. function pagination($pages = ”, $range = 4) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == ”) { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { …

Create your own shortcode in wordpress

Its very easy to Create your own shortcode in wordpress. Simply follow this code and copy from here to your wordpress function.php placed at the theme directory. This will create shortocde [wp_get_childpages] that is attached with a function  wp_get_list_child_pages() function wp_get_list_child_pages() { global $post; if ( is_page() && $post->post_parent ) $childpages = wp_list_pages( ‘sort_column=menu_order&title_li=&child_of=’ . …

Get you tube channel XML videos in php

    get_youtube_videos($user){ $str = ‘https://www.youtube.com/feeds/videos.xml?user=’.$user; $videos = $this->xml2array1($str); return $videos; }     function xml2array1($url, $get_attributes = 1, $priority = ‘tag’) { $contents = “”; if (!function_exists(‘xml_parser_create’)) { return array (); } $parser = xml_parser_create(”); if (!($fp = @ fopen($url, ‘rb’))) { return array (); } while (!feof($fp)) { $contents .= fread($fp, 8192); } …

XML to PHP array convert

function xml2array1($url, $get_attributes = 1, $priority = ‘tag’) { $contents = “”; if (!function_exists(‘xml_parser_create’)) { return array (); } $parser = xml_parser_create(”); if (!($fp = @ fopen($url, ‘rb’))) { return array (); } while (!feof($fp)) { $contents .= fread($fp, 8192); } fclose($fp); xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, “UTF-8”); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, trim($contents), $xml_values); xml_parser_free($parser); …