For fetching all HTTP headers in php use the following function:
apache_request_headers();
This function return all the headers but this function is useful only when you installed your php as an apache module.
It returns an associative array of all the HTTP headers in the current request or false on failure.
March 18th, 2011 | Posted in PHP | No Comments
When we are using database connectivity in wordpress, we can used the wpdb Class with declaring global variable $wpdb for connectivity we are using class to include.
wp-includes/wp-db.php.
To include wordpress functions, we use
include wp-blog-header.php
Read the rest of this entry »
March 18th, 2011 | Posted in Wordpress | No Comments
To handle multiple tags in query_posts,query can be customize regarding tags to set condition with the parameters.
there are some example :
1.Display posts that are tagged with both tag id 67 and tag id 57:
query_posts(array('tag__and' => array(77,87)));
2.To display posts from either tag id 27 or 47, you could use tag as mentioned above, or explicitly specify by using tag__in:
query_posts(array('tag__in' => array(37,27)));
3.Display posts that do not have any of the two tag ids 67 and 57:
query_posts(array('tag__not_in' => array(37,47)));
Understand more on query_posts.
March 18th, 2011 | Posted in Wordpress | No Comments
To make download link use the code snippet of file download.php and call the download.php in your hyperlink .
<a href="download.php?file=filepath">
filename</a>
Use the following code for your download.php.
download.php
Read the rest of this entry »
November 13th, 2010 | Posted in Wordpress | 1 Comment
To get the user details by login name you can use the function get_userdatabylogin
How to use get_userdatabylogin
$userdata = get_userdatabylogin($userlogin);
echo $userdata->user_login;
echo $userdata->user_email;
echo $userdata->user_url;
November 10th, 2010 | Posted in Wordpress | No Comments
This error appears because of PHP error reporting settings. Usually, it appears when variable is not properly set. There are two ways to handle this issue:
1. Check if $_POST['action'] is set before using it. For example:
if (!isset($_POST['action']))
{
//If not isset -> set with dumy value
$_POST['action'] = "undefine";
}
2. Suppress Notice warnings
Notice warnings could be suppressed by changing the error_reporting variable in your PHP.ini. error_reporting could be set to show all errors except those for notices and coding standards warnings: error_reporting = E_ALL & ~E_NOTICE
The same is accomplished by adding the following line in your php page:
<?php error_reporting(E_ALL ^ E_NOTICE); ?>
October 31st, 2010 | Posted in PHP | No Comments
If you want to call function when the page loads then you can use this method and can call your own function in the action of wp_head() in any page after header.
You have to create your own function in function.php
Read the rest of this entry »
October 29th, 2010 | Posted in Wordpress | No Comments
For example if you want to load a specifis style sheet for IE, just write :
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="{vb:raw vbcsspath}vbulletin-ie.css" />
<![endif]-->
This will allow the link to the style sheet only if the browser is IE not for others
You can also link style sheets according to various versions of IE , like this :
<!--[if IE6]>
<code>
<![endif]-->
And if you want to apply style sheet for all except IE , then write :
<!--[if !IE]><!-->
<link rel="stylesheet" type="text/css" href="not-ie.css" />
<!--<![endif]-->
October 28th, 2010 | Posted in CSS | No Comments
This could easily be done with javascript : For example : If your html file is like this: <html><head>....</head><body> <div id="testdiv" style="display:block;"> .......... <input type="button" id="sub" onClick="displayBlock()"> </body></html> And you want to hide the div ‘testdiv’ on the click event of button ‘sub’ , just write the following javascript code in the head tag of the same file : <script type="text/javascript"> function displayBlock() { document.getElementById('testdiv').style.display='none'; } </script> This code will call the displayBlock function on the button click and hide the div whose id will be ‘testdiv’.
October 27th, 2010 | Posted in Javascript | No Comments
WordPress Filter is a comprehensive post filtering & template system. It allows the user to define a set of simple “Catches” (criteria) to be met
WordPress filters allow to you modify virtually any kind of text displayed and are extremely powerful. WordPress filters allow you to modify posts, feeds, how authors are displayed in comments, and much, much more.
Filters: Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. Your plugin can specify that one or more of its PHP functions is executed to modify specific types of text at these times, using the Filter API.
Read the rest of this entry »
October 8th, 2010 | Posted in PHP, Wordpress | No Comments