Build a quick email template code

Build a quick email template by using below codes. Just change the suject, logo and site URL $to= “info@shakalya.com”; $subject = “Inquiry shakalya.com”; $msg =”<html><head><title>”.$subject.”</title></head><body style=’padding:50px 0px;background-color:#00688f;’>”; $msg .= “<div style=’padding:10px;max-width:500px;border-radius:5px 5px 0px 0px;background-color:#ddd;border:solid thin #ccc;margin:0px auto;overflow:auto;’><img src=’”.HTTPS_SERVER.”image/catalog/logo.png’ style=’height:50px;width:auto;float:right;’ /></div>”; $msg .=”<div style=’padding:20px 10px;max-width:500px;border:solid thin #ccc;margin:0px auto;background-color:#fff;’>”; $msg .=”Yoiur message goes here”; $msg .=”</div>”; $msg …

Defer iframe for your website to make your website loading fast

Defer iframe for your website to make your website loading fast. iframe source loading took some time and which blocks other scripts to load  as quickly as you can. We can defer the iframe so the other scripts can load quickly and our iframe will be loading after page scripts is fully loaded. This method …

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); …