【问题标题】:Increase Service Description/Excerpt Length Wordpress VC增加服务描述/摘录长度 Wordpress VC
【发布时间】:2018-01-23 23:39:13
【问题描述】:

我正在尝试更改 VC 在 Wordpress 中使用的服务摘录/描述的长度

我用过这个功能

function custom_excerpt_length( $length ) {
return 100;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

但是,这只能增加我所知道的帖子长度?我不确定 Services excerpt 与 VC 一起使用的功能

确切的类是 sc_services_item_description 但我不确定它是从哪里调用的

【问题讨论】:

    标签: php wordpress visual-composer


    【解决方案1】:

    您可以尝试下面的代码来应用自定义帖子类型的摘录限制。

    // CHANGE EXCERPT LENGTH FOR DIFFERENT POST TYPES
    
        function isacustom_excerpt_length($length) {
         global $post;
         if ($post->post_type == 'post')
         return 32;
         else if ($post->post_type == 'services')
         return 100;
         else
         return 80;
        }
        add_filter('excerpt_length', 'isacustom_excerpt_length');
    

    希望,它可能对你有用。谢谢。

    【讨论】:

      猜你喜欢
      • 2016-06-12
      • 1970-01-01
      • 2011-05-04
      • 2016-04-14
      • 2017-02-26
      • 1970-01-01
      • 1970-01-01
      • 2014-05-27
      相关资源
      最近更新 更多