Reputation: 1995
I'm writing a Wordpress plug-in that will add a button (or any HTML element) below the post title (or above if below is not possible). How can I do that?
Upvotes: 0
Views: 408
Reputation: 2567
You want to use the filter responsable for printing titles. I'm not sure exactly which one it is, but here's the function (it's likely single_post_title
as demonstrated):
add_filter( 'single_post_title', 'the_post_title', 10, 2 );
function my_more_link( $post_title ) {
$button_code = "your_button_HTML_here";
return str_replace( $post_title, $post_title . $button_code );
}
Upvotes: 1