ericmann / WP-Publication-Archive

Allows users to upload, manage, search, and download publications, documents, and similar content (PDF, Power-Point, etc.) in WordPress.
http://wordpress.org/extend/plugins/wp-publication-archive/
27 stars 12 forks source link

Filter title output #21

Closed MatthewEppelsheimer closed 11 years ago

MatthewEppelsheimer commented 11 years ago

Add filter to allow opportunity to avoid or modify appending " (Publication)" to publication title output.

The nested sprintf() makes me suspect there's a better way to do this… If this filter's in place, perhaps the plugin itself should use the filter to do what sprintf() does here, instead of including it by default. But, this gets the job done.

It will allow me to use this: https://gist.github.com/4527277

(There's also a random spelling correction included here.)

ericmann commented 11 years ago

Actually, the WP_Publication_Archive::the_title() function is already being added by a filter. Take a close look at the root plugin file and you'll see it hooked in at add_filter( 'the_title', array( 'WP_Publication_Archive', 'the_title' ), 10, 2 );

To remove the filter, just add: remove_filter( 'the_title', array( 'WP_Publication_Archive', 'the_title' ), 10 );. Since it's added with the default priority (10) you don't even need to specify that if you don't want to.

ericmann commented 11 years ago

I was, however, able to incorporate your spelling correction. :-)

MatthewEppelsheimer commented 11 years ago

Ha! Okay. This makes a lot more sense. Clearly I should've looked closer.