BLOG

A LITTLE STORY ABOUT MY JOURNEY

Custom Upload image WordPress

 

Upload image with resize

 

PHP & jQuery Add Multiple Field Add and Remove action

Using Javascript and PHP creating repeater field as html form you can use the following example :

Enjoy Your self: Credit : CoderSantosh

PHP slugify test

static public function slugify($text) { // replace non letter or digits by – $text = preg_replace(‘~[^\\pL\d]+~u’, ‘-‘, $text); // trim $text = trim($text, ‘-‘); // transliterate $text = iconv(‘utf-8’, ‘us-ascii//TRANSLIT’, $text); // lowercase $text = strtolower($text); // remove unwanted characters $text = preg_replace(‘~[^-\w]+~’, ”, $text); if (empty($text)) { return ‘n-a’; } return $text; } OR […]

Making sure PHP substr finishes on a word not a character

t could be done with a regex, something like this will get up to 260 characters from the start of string up to a word boundary: $line=$body; if (preg_match(‘/^.{1,260}\b/s’, $body, $match)) { $line=$match[0]; } OR $s = substr($string, 0, 261); $result = substr($s, 0, strrpos($s, ‘ ‘)); Rerence: http://stackoverflow.com/questions/1233290/making-sure-php-substr-finishes-on-a-word-not-a-character