请教:萧涵wordpress主题Xiaohan V3.0怎么把首页内容显示全文?

  [复制链接]
查看: 2189   回复: 12
发表于 2011-10-1 19:16:00 | 显示全部楼层 |阅读模式
本帖最后由 阿里爹地 于 2011-10-2 06:57 编辑

这个主题相信非常的出名,很多wordpress爱好者都知道!

最新版本首页默认文章显示第一段内容摘要,我现在想显示全文,可是技术比较差,删减修改了一些代码好像没用!

所以特地请教朋友们怎么办?

如果哪位童鞋帮我解决了,送本店所有视频教程!

主题下载地址:http://www.xiaohanseo.com/wp-content/uploads/2011/06/xiaohan3.zip

目前网站效果: http://www.zhuanshen1986.com/

首页index.php代码如下:
  1. <?php
  2. get_header(); ?>
  3.         <div id="container">
  4.             <div class="content">
  5.             <?php $options = get_option('xiaohan_options');
  6.                                 $wbid=$options['notice_content'];
  7. query_posts("showposts=1.&cat=$wbid"); if(have_posts()) : while(have_posts()) : the_post(); ?>
  8.             <?php  if(get_post_format( $post->ID )=='aside') : ?>
  9.             <div class="notice">
  10.                        <div class="t"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></div>
  11.                                 <div class="r"><span><?php the_time(__('m-d h:s')) ?></span><span class="com"><?php comments_popup_link('评论(<em>0</em>)', '评论(<em>1</em>)', '评论(<em>%</em>)', '评论关闭'); ?></span></div>
  12.             </div>
  13.                 <?php endif;?>
  14.             <?php endwhile;wp_reset_query();?>
  15.             <?php endif;?>
  16.                 <?php query_posts("$query_string.'posts_per_page=-1'&cat=-$wbid");if(have_posts()) : while(have_posts()) : the_post(); ?>
  17. <?php if(is_sticky()) : ?>
  18.             <div class="sticky" id="post-<?php the_ID(); ?>">
  19.                     <h2>[置顶] <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  20.             </div>
  21.             <?php elseif(get_post_format( $post->ID )=='') : ?>
  22.             <div class="post" id="post-<?php the_ID(); ?>">
  23.                     <div class="date"><span><?php the_time(__('Y')) ?></span><span class="f"><?php the_time(__('m')) ?>月<?php the_time(__('j')) ?></span></div>
  24.                     <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  25.                                 <div class="info">
  26.                     <span class="categories"><?php the_category(','); ?></span>
  27.                     <span class="tags"><?php the_tags('', ', ', ''); ?></span>
  28.                                         <?php if ($options['author']) : ?><span class="author"><?php the_author_posts_link(); ?></span><?php endif; ?>
  29.                     <?php edit_post_link(编辑, '','&raquo;'); ?>
  30.                     <span class="comments"><?php comments_popup_link('<em>0</em> Comments', '<em>1</em> Comment', '<em>%</em> Comments', 'Comments off'); ?></span>
  31.                                         <div class="clear"></div>
  32.                                 </div>
  33.                                 <div class="intro">
  34.                                         <?php if(is_category() || is_archive() || is_home() ) {
  35.                                                 the_excerpt();
  36.                                                 } else {
  37.                                                         the_content('Read the rest of this entry &raquo;');
  38.                                         }
  39.                                         ?>
  40.                                 </div>
  41.             </div>
  42. <?php endif; ?>
  43.             <?php endwhile;else : ?>
  44.             <div class="errorbox">
  45.                     <?php _e('Sorry, no posts matched your criteria.', 'xiaohan'); ?>
  46.                         </div>
  47.             <?php endif; ?>
  48.             <?php xiaohan_pagination($query_string); ?>
  49.                         <div class="clear"></div>
  50.                 </div><!-- #content -->
  51.         <?php include_once("sidebar.php"); ?>
  52.         </div><!-- #container -->
  53. <?php get_footer(); ?>
复制代码
发表于 2011-10-1 20:50:23 | 显示全部楼层
本帖最后由 hlzone 于 2011-10-1 21:00 编辑

在INDEX.PHP文件里有这段代码
<?php if(is_category() || is_archive() || is_home() ) {
                                                the_excerpt();
                                                } else {
                                                        the_content('Read the rest of this entry &raquo;');
                                        }
                                        ?>

如果你不想让首页显示摘要,那就把 || is_home()删除好了,如果不给力,再连同'Read the rest of this entry &raquo;'一起干掉。

反正我所知道的就是

显示完整内容为 the_content();

显示摘要内容为 the_excerpt();

就这两个函数

评分

参与人数 2T币 +3 收起 理由
阿里爹地 + 1
月光飞燕 + 2

查看全部评分

回复 支持 反对

使用道具 举报

发表于 2011-10-1 21:53:58 | 显示全部楼层
刚接触wordperess。看看。
回复 支持 反对

使用道具 举报

发表于 2011-10-2 00:23:46 | 显示全部楼层
坦克也是用的这个主题,不过他改的更有个性,还是不错的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-10-2 06:31:16 | 显示全部楼层
坦克也是用的这个主题,不过他改的更有个性,还是不错的。
woshigaozhen 发表于 2011-10-2 00:23 请教:萧涵wordpress主题Xiaohan V3.0怎么把首页内容显示全文?



    他有我的个性么?

网站:http://www.zhuanshen1986.com/
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-10-2 06:58:06 | 显示全部楼层
在INDEX.PHP文件里有这段代码


如果你不想让首页显示摘要,那就把 || is_home()删除好了,如果不给力,再 ...
hlzone 发表于 2011-10-1 20:50 请教:萧涵wordpress主题Xiaohan V3.0怎么把首页内容显示全文?



    不给力啊  还是没用!请教:萧涵wordpress主题Xiaohan V3.0怎么把首页内容显示全文?
回复 支持 反对

使用道具 举报

发表于 2011-10-2 11:05:22 | 显示全部楼层
老弟最近做大买卖le ???
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-10-2 11:09:34 | 显示全部楼层
老弟最近做大买卖le ???
imchazi 发表于 2011-10-2 11:05 请教:萧涵wordpress主题Xiaohan V3.0怎么把首页内容显示全文?



    啥大买卖哦  快解决问题先!
回复 支持 反对

使用道具 举报

发表于 2011-10-2 14:05:40 | 显示全部楼层
你改成酱紫了,还不如去请教萧寒本人去。花点小钱帮你弄好了。
回复 支持 反对

使用道具 举报

发表于 2011-10-2 22:06:00 | 显示全部楼层
那就把这两个互换下看看吧: the_excerpt(); 改为the_content();
回复 支持 反对

使用道具 举报

发表于 2011-10-3 08:41:46 | 显示全部楼层
这个学习一下,一直不太会改代码!唉。。。
回复 支持 反对

使用道具 举报

发表于 2011-10-3 09:47:32 | 显示全部楼层
本帖最后由 诺基亚 于 2011-10-3 09:48 编辑

我看了下,觉得写得很一般啊。代码混乱,特别是function.php里面

如果要用,
打开index.php


找到<div class="intro">
                                        <?php if(is_category() || is_archive() || is_home() ) {
                                                the_excerpt();
                                                } else {
                                                        the_content('Read the rest of this entry &raquo;');
                                        }
                                        ?>
                                </div>

修改成
<div class="intro">
                                        <?php the_content();
                                        ?>
                                </div>



打开function.php,找到最后,删除

function lpa_replace_content($content)
{
        // Get data from database
        $lpa_post_wordcut = get_option("lpa_post_wordcut");
       
        $lpa_post_letters = get_option("lpa_post_letters");
        $lpa_post_linktext = get_option("lpa_post_linktext");
        $lpa_post_ending = get_option("lpa_post_ending");
       
        $lpa_post_home = get_option("lpa_post_home");
        $lpa_post_category = get_option("lpa_post_category");
        $lpa_post_archive = get_option("lpa_post_archive");
        $lpa_post_search = get_option("lpa_post_search");
        $lpa_striptags = get_option("lpa_striptags");

        // If post letters are not set, default is set to 300
        if ($lpa_post_letters == ""){
                $lpa_post_letters = 300;
        }
        if ( is_home() || is_category() || is_archive() || is_search() ) {
               
                        $paragraphcut = explode('</p>', $content);
                        global $post;
                        $ismoretag = explode('<!--',$post->post_content);
                        $ismoretag2 = explode('-->', $ismoretag[1]);
                        if ($ismoretag2[0] != "more") {
                                echo $paragraphcut[0];
                                echo $lpa_post_ending;
                                if ($lpa_post_linktext != ""){
                                        //mark080717 echo " <a href='" .get_permalink(). "' rel=\"nofollow\">".utf8_encode($lpa_post_linktext)."</a>";
                                        echo "<a href='" .get_permalink(). "' rel=\"nofollow\">".$lpa_post_linktext."</a>";
                                }
                                echo "</p>";
                        }
                        else {
                                return $content;
                        }
                }
                else {
                        return $content;
                }
       
}
add_filter('the_content','lpa_replace_content');

评分

参与人数 1T币 +2 收起 理由
阿里爹地 + 2 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-10-4 20:07:26 | 显示全部楼层
我看了下,觉得写得很一般啊。代码混乱,特别是function.php里面

如果要用,
打开index.php


找到
                                       
...
诺基亚 发表于 2011-10-3 09:47 请教:萧涵wordpress主题Xiaohan V3.0怎么把首页内容显示全文?


可以了  呵呵  谢谢诺基亚!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则