Revision: 51379
Updated Code
at September 22, 2011 14:52 by kreamweb
Updated Code
//call add_filter or add_action inside a class
add_filter('posts_where', array( &$this, 'filter_where' ));
//example
class IP_Ban {
function IP_Ban()
{
$this->__construct();
} // function
function __construct()
{
new IP_Ban_Options;
add_action( 'admin_init', array( &$this, 'admin_init' ) );
add_action( 'init', array( &$this, 'init' ) );
} // function
function admin_init()
{
# perform your code here
} // function
function init()
{
# perform your code here
} // function
}
Revision: 51378
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 22, 2011 14:50 by kreamweb
Initial Code
//modo per richiamare un add_filter all'interno di una classe
add_filter('posts_where', array( &$this, 'filter_where' ));
//esempio
class IP_Ban {
function IP_Ban()
{
$this->__construct();
} // function
function __construct()
{
new IP_Ban_Options;
add_action( 'admin_init', array( &$this, 'admin_init' ) );
add_action( 'init', array( &$this, 'init' ) );
} // function
function admin_init()
{
# perform your code here
} // function
function init()
{
# perform your code here
} // function
}
Initial URL
Initial Description
Initial Title
wordpress - Call add_filter or add_action inside a class
Initial Tags
wordpress
Initial Language
PHP