Skip to content

Instantly share code, notes, and snippets.

@cyberwani
Forked from eteubert/example.php
Created December 28, 2012 09:29
Show Gist options
  • Select an option

  • Save cyberwani/4396371 to your computer and use it in GitHub Desktop.

Select an option

Save cyberwani/4396371 to your computer and use it in GitHub Desktop.
<?php
/**
* My Plugin
*
* @uses add_filter() for 'the_content': make love not content
* @uses add_filter() for 'get_the_excerpt': clearly announce all excerpts
*/
class my_plugin
{
function __construct() {
// make love not content
add_filter( 'the_content', function ( $content ) {
return $content . " ♥";
});
// clearly announce all excerpts
add_filter( 'get_the_excerpt', function ( $excerpt ) {
return '<strong>' . __( 'EXCERPT' ) . ':</strong> ' . $excerpt;
});
}
}
<?php
add_filter( 'tag', 'myfunname' /* ... */ );
add_filter( 'tag', array( $this, 'myfunname' ) /* ... */ );
add_filter( 'tag', array( __CLASS__, 'myfunname' ) /* ... */ );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment