Monthly Archive: March 2011
The following example will show the content of post id 30 <?php $postid = 63;//This is page id or post id $post = get_post($postid); $title = $post->post_title; $content = $post->post_content; $content = apply_filters(‘the_content’, $content);...
Here are some examples by which you can add or subtract date. e.g these simple codes can find the 2 week before or after date. Subtracting Years from a date $date = “1988-08-01”; $newdate...
Get country name from ip-address <?php function countryCityFromIP($ipAddr) { //function to find country and city from IP address //verify the IP address for the ip2long($ipAddr)== -1 || ip2long($ipAddr) === false ? trigger_error(“Invalid IP”, E_USER_ERROR)...
Using “is_user_logged_in” function You can check user login or not. e.g <?php if(is_user_logged_in()): ?> echo “Insert your HTML or PHP code here”; <?php else: wp_die(‘Sorry, you must first <a href=”/wp-login.php”>log in</a> to view this...