Month: April 2017

Jquery & Javascript

Split a string using jquery

Let string be: var str=”hello/how/are/u?”; Split string by “/”. var res = str.split(“/”); //getting complete result. alert(res); // getting each value in the array alert(res[0]); alert(res[1]);

wordpress

Adding new image size in wordpress

Define the new image size in your functions.php add_image_size( ‘cat-thumb’, 98, 113,true ); Now we have defined a new image size with size 98X113 and name ‘cat_thumb’. Third parameter shows, if we need hard crop the image with the defined size. Otherwise we can omit the third parameter. Call the image size using: the_post_thumbnail(‘cat-thumb’);

HTML

How to add ‘required’ field to radio buttons

Add ‘required’ to any of the radio group elements: <input type=”radio” name=”acces” value=”all” required>All</input> <input type=”radio” name=”acces” value=”mobile”>Mobile</input> <input type=”radio” name=”acces” value=”desktop”>desktop</input>