Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Execute Hooks on pages without Hooks.
#1
This might come in handy for someone...

When writing my latest plugin I need a hook on the pages.php page, unfortunaltely there is only header and footer executed on that page. Hooking into "footer" meant my function were run on all backend pages.

This little snippet allows you only to run on the pages you want;

Code:
$bt = debug_backtrace();
$shift=count($bt) -1;    

if (pathinfo_filename($bt[$shift]['file'])=="pages"){     // changes pages to the page your looking for.
    add_action('footer','your_function',array());    
}
My Github Repos: Github
Website: DigiMute
Reply


Messages In This Thread
Execute Hooks on pages without Hooks. - by n00dles101 - 2011-06-15, 05:58:54
Execute Hooks on pages without Hooks. - by Carlos - 2011-06-15, 06:23:33
Execute Hooks on pages without Hooks. - by Carlos - 2011-06-15, 07:28:40
Execute Hooks on pages without Hooks. - by Carlos - 2011-06-15, 07:35:28



Users browsing this thread: 1 Guest(s)