The tag has no wiki summary.

learn more… | top users | synonyms

26
votes
3answers
1k views

How to remove a filter that is an anonymous object?

In my functions.php file I would like to remove the below filter, but I'm not sure how to do it since it's in a class. What should remove_filter() look like? add_filter('comments_array',array( ...
0
votes
1answer
202 views

OOP Plugin: Where should I place the action hooks in the class?

Where in my admin class should I place the action hooks for adding css, scripts and the add menu page? In the __construct? Or should they be placed in a method?
1
vote
2answers
476 views

uml diagrams of wordpess

Where can I find UML diagrams of WordPress (Data flow diagrams,State diagram, component diagram, use case diagram, deployment diagram)?
9
votes
2answers
2k views

Why do some hooks not work inside class context?

I'm pretty stumped on this one. I'm using add_action inside my plugin class to do certain things- add scripts & styles to the head, wp_ajax, etc. Here's the actions, in the __construct: function ...
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 ...
3
votes
3answers
344 views

scheduled event not getting executed

class checkPost{ function __construct() { if ( !wp_next_scheduled('my_task_hook') ) { wp_schedule_event( time(), 'hourly', 'my_task_hook' ); // hourly, daily and twicedaily } ...
1
vote
2answers
214 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 ...
2
votes
2answers
566 views

Check to see if page exists problems

I've created a class to dynamically create pages. I'm checking to see if the page exists by comparing the new page's title to post_name. The comparison seems to work ok, but even if there is a match ...
9
votes
1answer
2k views

Using classes instead of global functions in functions.php

In many themes I've seen (including TwentyEleven) and in the examples I've found online, when building the functions.php file for a theme all functionality is declared in a global scope. To clarify, ...
18
votes
5answers
1k views

Should all plugins be encapsulated in a Class?

When developing a plugin should the functions be grouped together into a Class to avoid namespace conflicts? Does using classes create performance overheads for PHP? If there is a performance hit, ...
9
votes
1answer
3k 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 ...
7
votes
1answer
840 views

Registering Class methods as hook callbacks

I'm not sure if I have done this correctly. As I understand it: if I have a class foo and a static method bar I can register that as the callback by passing the array array("foo","bar") as the ...
4
votes
2answers
2k views

Does an activated plugin automatically mean its methods are available to other WP functions?

I made a WordPress plugin like this: Class MY_CLASS { //codes } Global $myclass; $myclass = New MY_CLASS (); After installed and activated the plugin, can I use this class in other plugins without ...
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 ...
8
votes
2answers
3k views

Will WordPress become completely OOP?

Is there any information about WordPress becoming completely OOP in future versions?
1
vote
2answers
541 views

problem with implementing widget via the_content()

hey guys, I really need you help with this one. I'm using the subscribe2 Plugin (for email subscriptions). I want to show the signup form as a widget. The plugin author recommends doing it the ...
2
votes
1answer
430 views

PHP5, Inheritance, Singleton - action & filter hook limitations

I'm currently working on a plugin, which uses the builtin cron functionality of wordpress. Instead of using PHP4, I want to use PHP5 with inheritance and the singleton design pattern. I run in some ...
1
vote
3answers
568 views

Ajax with OOP doesn't work

I have a small script within theme's functions.php file that uses ajax, principle like this: add_action('admin_head', 'rw_script'); function rw_script() { echo ' <script ...
24
votes
6answers
3k views

Using OOP in themes

I see a lot of plugins making use of object-oriented coding when there isn't really necessary. But what's even worse is that theme developers are starting to do the same thing. Commercial themes and ...