【问题标题】:How to Return <div> in WordPress Function php file如何在 WordPress 函数 php 文件中返回 <div>
【发布时间】:2022-01-18 17:51:30
【问题描述】:

我正在尝试在返回周围放置一个 div。不知道怎么...

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

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

【问题讨论】:

    标签: php html wordpress function


    【解决方案1】:

    试试这个:

     add_filter( 'the_content', function( $content ) {
        if (is_singular('cda')) { 
    
      ?><div class="yourclass"><?php
      return get_the_term_list( get_the_ID(), 'cda_cat', 'Product:' ).$content;
      ?></div><?php
      }
     
      
    }, -10);
    

    【讨论】:

      猜你喜欢
      • 2022-12-19
      • 1970-01-01
      • 2017-05-16
      • 1970-01-01
      • 2011-09-04
      • 1970-01-01
      • 2016-05-19
      • 2013-02-24
      • 1970-01-01
      相关资源
      最近更新 更多