July 31, 2013WordPressoop, WordPressadmin

Object-Oriented WordPress Plugins

Object oriented programming takes away pointers to functions and introduces polymorphism. PHP doesn’t use pointers in a way that C does, but a variant of these pointers to functions can be observed in Variable Functions. This allows a programmer to use the value of a variable as the name of a function, which brings us to OOP with WordPress.

One of my favourite plugins is created by Ian Dunn. I attached a link to a presentation where he is introducing:

Creating Object-Oriented WordPress Plugins

. Follow him and you’ll learn a lot about how to organize your futur plugins for WordPress.

Source: http://iandunn.name/wp-content/misc/2013/wp-oop-mvc/oop.html#/42

Here is another one talking about the same topic but with a different approach. Check it out: http://net.tutsplus.com/tutorials/php/from-procedural-to-object-oriented-php/

July 31, 2013WordPressCustom Content, WordPressadmin


I just found a sweet and short introduction on how to attach HTML to the current content!

add_filter('the_content', 'add_post_content');

Basically, you append the post content after your custom content, then return the result.

function theme_slug_filter_the_content( $content ) {

$custom_content = 'YOUR CONTENT GOES HERE'; $custom_content .= $content; return $custom_content;


add_filter( 'the_content', 'theme_slug_filter_the_content' );

Have fun! Cheers,