Author Archives: Bhagwat Singh

Converting String URLs to Clickable Links with PHP

Recently I came across a problem, I needed to convert a plain text string, that could possibly have a URL in it, to a string with clickable URLs. This is possible with the right PHP code. I created a simple … Continue reading

Comments Off on Converting String URLs to Clickable Links with PHP

Backup Your MySQL Database Using PHP

This is the most important thing, i think useful for the developers. because at some situation we need customized dump of db or particular tables. here is the way of doing it. function fnBackup_Tables($host,$user,$pass,$name,$tables) { $link = mysql_connect($host,$user,$pass); mysql_select_db($name,$link); $return … Continue reading

Comments Off on Backup Your MySQL Database Using PHP

Show Posts Order By Date in a Category Page

if(is_category()){ $category = get_the_category(); $category_id = $category[0]->term_id; //$category_id = get_cat_ID($category->cat_ID); $args = array( ‘cat’ => $category_id, ‘orderby’ => ‘post_date’, ‘order’ => ‘ASC’ ); query_posts( $args ); }

Comments Off on Show Posts Order By Date in a Category Page

Pass a Value to input Field using Jquery.

Hello, here is the way to pass a value to a input field.. $(‘.user_login’).val(“type your text here”); // here is . is name of that input field. what if input field is hidden, then u need to use this piece … Continue reading

Comments Off on Pass a Value to input Field using Jquery.

PHP Shorthand If/Else Using Ternary Operators

An essential part of programming is evaluating conditions using if/else and switch/case statements. If / Else statements are easy to code and global to all languages. If / Else statements are great but they can be too long. here is … Continue reading

Comments Off on PHP Shorthand If/Else Using Ternary Operators

Change Page title tag using jQuery

Here is a way to change the title tag of the document when page is loaded and ready. jQuery(document).ready(function() { jQuery(“title”).html(“Insert your new title here”); });

Comments Off on Change Page title tag using jQuery

Add A Page Template In WordPress

coming soon…

Comments Off on Add A Page Template In WordPress

Jquery Form Validation

There are many ways for form validation using Jquery. here is the simplest example Using Jquery & Alert. $(document).ready(function(){ $(‘#contactus’).submit(function() { var error = 0; var full_name = $(‘#full_name’).val(); var email_address = $(‘#email_address’).val(); var phone_number = $(‘#phone_number’).val(); var country = … Continue reading

Comments Off on Jquery Form Validation

Pad a number with leading zeroes in Javascript

As far as I know there isn’t a in-built way with Javascript to pad a number with leading zeroes to make it a fixed width like str_pad in PHP programming language. This post looks at a way to pad a … Continue reading

Comments Off on Pad a number with leading zeroes in Javascript

Reading Gmail With PHP IMAP

Hello Friends, Yesterday i have researched on quite interesting topic that how we can Retrieve Your Gmail Emails Using PHP and IMAP. Here is the simplest solution than using a HUGE MAIL Library. /* connect to gmail */ $hostname = … Continue reading

Comments Off on Reading Gmail With PHP IMAP