betoesquivel

Nuevaprensa, banner de opinión

Jan 12th, 2015
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. //Insert a banner to the beginning of post content
  2. function add_banner( $content ) {
  3. if( !is_single() ) {
  4. // Do not show banner on anything other than single post pages
  5. // Just leave content alone
  6. return $content;
  7. } else {
  8. // if it is a post and it is in category opinion... display this.
  9. if( in_category('opinion') ){
  10. $banner = '<p style="font-style:italic;">*Las opiniones expresadas en este artículo son de exclusiva responsabilidad del autor y no necesariamente representan la opinión de Grupo Nueva Prensa.</p>';
  11. return $banner . $content;
  12. }
  13. return $content;
  14. }
  15.  
  16. }// end of function add_banner
  17.  
  18. add_filter('the_content','add_banner');
Advertisement
Add Comment
Please, Sign In to add comment