Thirupathi
Joined: 01 Dec 2009 Posts: 116
|
Posted: Tue Jul 20, 2010 3:52 am Post subject: How to add actions and filters in wordpress |
|
|
Hi Friends, I posted here the topic regarding "How to add adctions and filters in wordpress".
//This filter is to convert all the WordPress instances to WORDPRESS in the posts content
add_filter('the_content',array('WordPress2WORDPRESS','the_content'));
class WordPress2WORDPRESS{
function the_content($content){
return preg_replace('/WordPress/','WORDPRESS',$content);
}
}
//This action is to add the my custom menu in admin area of wordpress
add_action('admin_menu',array($news,'news_add_pages'));
function news_add_pages()
{
add_menu_page( $this->page_title,
$this->menu_title, $this->access_level,
$this->plugin_dir, array ( $this , 'main_page'), $this->imgUrl.'pageFlip.gif' );
add_submenu_page( $this->plugin_dir, __('Categories', 'news'),
__('Categories', 'news'), $this->access_level,
'categories', array( $this, 'categories' ) );
add_submenu_page( $this->plugin_dir, __('Images', 'news'),
__('Images', 'news'), $this->access_level,
'images', array( $this, 'images' ) );
}
It might be helping you,
Thank you,
Thirupathi.J. |
|