2012-07-15 116 views
0

我想删除摘录功能或呈现它无功能,因为我希望所有的职位被充分查看其内容。我认为这个主题有一些跟踪,以确保摘录是在那一行,所以它必须存在。wordpress主题摘录功能消除thao工作室主题

function excerpt($limit) { 
     $excerpt = explode(' ', get_the_excerpt(), $limit); 
     if (count($excerpt)>=$limit) { 
     array_pop($excerpt); 
    $excerpt = implode(" ",$excerpt).'...'; 
    } else { 
    $excerpt = implode(" ",$excerpt); 
    } 
    $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); 
    return $excerpt; 
} 

function content($limit) { 
    $content = explode(' ', get_the_content(), $limit); 
    if (count($content)>=$limit) { 
    array_pop($content); 
    $content = implode(" ",$content).'...'; 
    } else { 
    $content = implode(" ",$content); 
    } 
    $content = preg_replace('/\[.+\]/','', $content); 
    $content = apply_filters('the_content', $content); 
    $content = str_replace(']]>', ']]>', $content); 
    return $content; 
} 

我只有这2行代码,我知道是相关的。 我不知道$限制来自哪里,我试图找到所有主题相关的PHP,没有发现。 请帮帮我。非常感谢你。

+0

你想显示完整的内容,而不是你的主题摘录? – 2012-07-15 18:38:58

+0

是的,如果可能的话。我试图尽可能长时间地做出摘录,以便它显示完整但失败 – 2012-07-15 18:40:48

+0

为什么不在主题中使用the_content()? – 2012-07-15 18:41:48

回答

0

只要找到你想要显示的全部内容,而不是摘录内容,并与the_content()替换循环内的功能the_excerpt()模板文件(可能的index.php),即

<?php if (have_posts()) : ?> 
      <?php while (have_posts()) : the_post(); ?>  
      <!-- do other stuff ... --> 
      the_content(); 
      <?php endwhile; ?> 
<?php endif; ?> 

关于the_content()loop

+0

heera非常感谢你的提示 – 2012-07-16 12:48:52

+0

是否工作? – 2012-07-16 12:51:53

+1

是的谢谢你,我感谢你给了我额外的功能,但我只是想展示整个内容,所以我只是用内容替换了摘录,非常感谢提示:) – 2012-07-18 13:32:56