lundi 23 mars 2015

Hook Adding content after title


I need to add something after title in loop in single post and page, home page, categories. This is for a plugin and i don't want to modify the theme directly.



function after_title($title) {

if (!is_admin() || is_single() || is_page() || is_home() || is_category() ) {

$write = 'AFTER TITLE';
$after_title = $title.$write;
return $after_title ;

}

}
add_filter( 'the_title', 'after_title' );


But it add content everywhere, in the widget or sidebare loop and even in my menu. I just want to do it in the main content, not everywhere.


I also tryed other ways but i had the same problems.



add_action('the_post', 'atr_insert');
add_action('the_content', 'atr_insert');




Aucun commentaire:

Enregistrer un commentaire