Can we hook a static method of a class to add_action inside that class?
register_activation_hook only runs once i.e. when the plugin is first activated – use the init hook instead to “boot up” your plugin: add_action( ‘init’, ‘LocatorMap::init’ );
register_activation_hook only runs once i.e. when the plugin is first activated – use the init hook instead to “boot up” your plugin: add_action( ‘init’, ‘LocatorMap::init’ );
Short answer: Plugins do not modify existing files, they hook into WordPress via an exposed API. Plugins can modify database schema. Plugins don’t have to uninstall cleanly. Plugin Hooks Plugins hook into WordPress at specific point exposed by the WordPress core. http://codex.wordpress.org/Plugin_API As an example, the function get_option() reads a site option from the database. … Read more
If you don’t want him to see the admin stuff, don’t make him an admin, create an author account for him. He can use the quickpress dashboard widget to add posts from the dashboard. You can remove the other dashboard widgets so it’s the only one there. You can also use remove_menu_page() to remove any … Read more
WP-MPDF has always worked extremely well for me and has a decent templating system you can override. Thanks!
The settings framework can’t detect data that is not posted, so either use a call to update_option or (what I sometimes do) use a yes/no radio button rather than a checkbox. With a radio button where the default value is 0 (no) and the alternative is 1 (yes), the user is setting the post value … Read more
As suggested by @Jeff Mattson, hours of research and testing suggest that this is probably due to mod_security. I also investigated the likelihood of it being due to Suhosin, but I don’t think it’s to blame. Here’s the deal. It doesn’t really help if we verify that the problem is due to mod_security. We don’t … Read more
I experienced a similar problem with an Ajax request. There are a couple of important things to note. Allow me to first state the obvious: Make sure that your code using the option_active_plugins filter is inside your mu-plugins folder. It will not work for if your plugin is a regular plugin. Not even if you … Read more
I sent it to you on Twitter, but here it is again. I made this little class to help me do XML-RPC faster. abstract class MZAXMLRPC { protected $calls = Array(); protected $namespace = “myxmlrpc”; function __construct($namespace){ $this->namespace = $namespace; $reflector = new ReflectionClass($this); foreach ( $reflector->getMethods(ReflectionMethod::IS_PUBLIC) as $method){ if ($method->isUserDefined() && $method->getDeclaringClass()->name != get_class()){ … Read more
I’ve done this two ways: 1) – a csv export function – detect that special content type handling is required BEFORE wp outputs anything. add_action (‘plugins_loaded’, ‘amr_meta_handle_csv’); function amr_meta_handle_csv ($csv, $suffix=’csv’) { // chcek if there is a csv request on this page BEFORE we do anything else ? if (( isset ($_POST[‘csv’]) )) { … Read more
You can check SoJ User Time Zone plugin available on WP Plugin Directory. Also here is a hack using JS if you want to auto detect your User’s TimeZone. By the way, it’s very handy using JS Date object which has getTimeZoneOffset() method, which is keyrole player.