0
votes
1answer
29 views

A question about add_action()

I was following this ( http://codex.wordpress.org/Plugin_API ) tut on codex. The part where a class is created and is called in add_action. No argument was passed to emailer::send ? Why? It was ...
0
votes
1answer
179 views

How To Remove The Filter That Adds JetPack Related Content To Dom

I am trying to remove the filter in JetPack's Related Posts module that adds the element to the DOM that the module's JavaScript populates with the related posts. Once I remove it, I can achieve my ...
1
vote
1answer
91 views

Single Responsibility Principle and WP Classes

Still working my way through OOP and Solid principles. I’m having a hard time getting around having to have many new SomeClass(); calls, or adding them to an action hook ( add_action( 'init', array( ...
2
votes
1answer
191 views

Using a front controller in a Wordpress plugin, any suggestions?

My idea was to use a front controller in our plugin. has anyone done that already? The responsibilities of the controller should be initiate router class; provide access to objects registry, which ...
0
votes
3answers
140 views

How to make method from plugin available in theme?

Let's say this was in my plugin: class pluginslug_foo { public function bar() { //stuff } } and I wanted to make the method bar available for use outside of the plugin, for ...
0
votes
3answers
99 views

Registering and using actions which return results in a Plugin class

I have a plugin class which contains a function spektrix_list_events() class SpektrixPlugin { public function __construct(){ add_action( 'init', array ( $this, 'init' )); } ...
6
votes
1answer
426 views

How to create a flexible abstraction for WP_Query?

My question is about php but it involves wordpress as i am creating a plugin. The case is that i have 5 questions, each question have 6 choices and one choice to choose from each. Now the person would ...
1
vote
1answer
69 views

Advice on plugin structure

I'm looking for a bit of advice on structuring the classes within a plugin I'm writing for my charity website. At the moment the plugin is OOP based with a single class. However, its becoming quite ...
6
votes
2answers
691 views

What is the correct way to build a widget using OOP

I am working on a simple search form widget, with a built in autocomplete capability (You can download the current version here). The plugin is working, but I am currently rewriting all the code using ...
0
votes
1answer
132 views

How do I create Widget within plugin that uses its own class?

I wrote WordPress plugin and want to include 2 extra Widgets with it... if( !class_exists('plugin_name') ) { class plugin_name { // plugin code } } // include widgets code ...
1
vote
2answers
929 views

PHP error with shortcode handler from a class

Currently i am using the following generic flow for adding the shortcode for a plugin. class MyPlugin { private $myvar; function baztag_func() { print $this->myvar; ...
3
votes
1answer
1k views

Using a plugin class inside a template

I am writing a plugin to send an invitation to a friend which opens up a form when a link is clicked. I encapsulated all the functions in class by following the code given in the Report Broken Video ...
1
vote
2answers
216 views

Applying OO patterns and principles to plugin development

I'm busy writing my first plugin, using PHP 5.3.5. I come from a C# environment, and I must say I'm more than happy with the level of support for good, solid OOP techniques in PHP. However, I'm a ...
9
votes
1answer
4k views

Plugin Form Submission Best Practice

I have done a lot of researching and haven't found quite what I am looking for, so I am hoping that I can be pointed in the right direction. I am developing an Events plugin that will book a ticket ...
3
votes
3answers
1k views

Plugin Architecture/Design Pattern - is better to use a private Observer/Mediator Pattern for plugin subclasses or WP add_action?

I'm coding a very complex plugin which it's organized as a parent "container" class and several subclasses, where each subclass is an optional/mandatory element which usually (but not always) maps to ...