Home > Net >  How to Return <div> in WordPress Function php file
How to Return <div> in WordPress Function php file

Time:12-16

I'm trying to put a div around the return. Didn't know how...

add_filter( 'the_content', function( $content ) {
    if (is_singular('cda')) {  

  return get_the_term_list( get_the_ID(), 'cda_cat', 'Product:' ).$content;
  
  }
 
  
}, -10);

CodePudding user response:

try this:

 add_filter( 'the_content', function( $content ) {
    if (is_singular('cda')) { 

  ?><div ><?php
  return get_the_term_list( get_the_ID(), 'cda_cat', 'Product:' ).$content;
  ?></div><?php
  }
 
  
}, -10);
  • Related