Skip to content

Commit

Permalink
fix: article list for .home-content
Browse files Browse the repository at this point in the history
  • Loading branch information
zolunx10 committed Apr 16, 2012
1 parent 7f786b0 commit 6cb7ff6
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 42 deletions.
40 changes: 27 additions & 13 deletions _/css/main.css
Expand Up @@ -30,8 +30,8 @@ a:hover {
color:#CE1719;
text-decoration:underline;
}
.entry-title, .entry-title a{font-family:"Microsoft YaHei", Helmet, Freesans, sans-serif;
}
.entry-title, .entry-title a{font-family:"Microsoft YaHei", Helmet, Freesans, sans-serif; }

.post p {
margin-bottom:5px;
line-height:1.4em;
Expand Down Expand Up @@ -81,10 +81,27 @@ body {
}
.post {
margin-bottom:20px;
padding:5px 0;
}
.page-wrap {
margin-top:20px;
}
.page-wrap {
width:945px;
}
.home-content .page-wrap {
width:700px;
}
.home .page-wrap {
margin-top:0;
}
.home-content {
overflow-y:auto;
min-height:400px;
}
.home-content .li {
border-bottom:1px dashed #F0F0F0;
}
.navigation {
clear:both;
margin:15px auto 0 auto;
Expand Down Expand Up @@ -132,7 +149,7 @@ body {
/* header
*/
.home #header {
padding-top:80px;
padding-top:40px;
}
#header {
padding-top:20px;
Expand Down Expand Up @@ -231,6 +248,9 @@ li.current_page_item a {
.post h2 {
font-size:20px;
}
.post h3 {
font-size:16px;
}
.post header {
color:#333;
margin-bottom:10px;
Expand All @@ -239,11 +259,12 @@ li.current_page_item a {
margin-top:8px;
}

.category header h2 {
.category h3.entry-title {
display:inline;
}
.category header .meta {
.category .meta {
display:inline;
float:right;
margin-left:5px;
}
/* book
Expand Down Expand Up @@ -281,16 +302,9 @@ li.current_page_item a {

/* postgraduate
*/
.category .category-postgraduate {

}
/* TODO */
.category article.category-postgraduate {
display:inline;
float:left;
margin:10px 20px;
}

}

/* home
*/
Expand Down
1 change: 0 additions & 1 deletion _/js/functions.js
Expand Up @@ -65,7 +65,6 @@ exports.makeGallery= function(settings) {


/* trigger when page is ready */

$(document).ready(function(){
//左右键翻页
if ($('.navigation').length>0) {
Expand Down
6 changes: 1 addition & 5 deletions archive.php
@@ -1,7 +1,3 @@
<?php
if (in_category('blog')) {
include (TEMPLATEPATH . '/single.php' );
} else {
include (TEMPLATEPATH . '/category.php');
}
//有category.php的情况下会被覆盖
?>
2 changes: 1 addition & 1 deletion category-blog.php
@@ -1 +1 @@
<?php include (TEMPLATEPATH . '/page.php' ); ?>
<?php include (TEMPLATEPATH . '/category.php' ); ?>
26 changes: 15 additions & 11 deletions category.php
Expand Up @@ -9,7 +9,7 @@
if (have_posts()) :
while (have_posts()) : the_post();
$content= get_the_content();
if ($name==="book" || $name==="postgraduate") {
if ($name==="book") {
// 著作, 提取img作为封面
$RE_SRC= '/<img[^>]*src="?([^ ">]*)"?[ >]/i';
preg_match($RE_SRC, $content, $t);
Expand All @@ -29,29 +29,33 @@
}

?>
<article <?php post_class("clearfix") ?>>
<?php if ($name==="book") { ?>
<article <?php post_class("clearfix") ?>>
<div class="cover">
<img src="<?php echo $t?$t[1]:'' ?>" width="100" alt="" />
</div>
<?php } ?>
<header>
<h2 class="entry-title" id="post-<?php the_ID(); ?>"><a href="<?php echo $link ?>">
<?php if ($name==="postgraduate") { ?>
<div class="photo">
<img src="<?php echo $t?$t[1]:'' ?>" width="100" alt="" />
</div>
<?php $content= "";
} ?>
<h3 class="entry-title" id="post-<?php the_ID(); ?>"><a href="<?php echo $link ?>">
<?php the_title();?>
</a></h2>
</a></h3>
<div class="meta">
<?php edit_post_link(__("编辑", 'tbdata'), '<span class="edit-link">', '</span>') ?>
</div>
</header>
<div class="entry">
<?php echo apply_filters('the_content', $content); ?>
</div>
<?php } else { ?>
<article <?php post_class("li clearfix") ?>>
<h3 class="entry-title" id="post-<?php the_ID(); ?>"><a href="<?php echo $link ?>">
<?php the_title();?>
</a></h3>
<div class="meta">
<?php edit_post_link(__("编辑", 'tbdata'), '<span class="edit-link">', '</span>') ?>
<span class="comment-count" style="color:#333;">(<?php echo get_comments_number(); ?>)</span>
<span><?php the_time("Y-m-d h:i") ?></span>
</div>
<?php } ?>
</article>
<?php endwhile;
include (TEMPLATEPATH. '/_/inc/nav.php');
Expand Down
11 changes: 10 additions & 1 deletion footer-public.php
Expand Up @@ -73,5 +73,14 @@
<?php } ?>
</ul>
</nav>
<!-- #items-->
<script type="text/javascript">
//满屏高度
(function($) {
$(document).ready(function() {
var h=document.body.clientHeight-$('div.home-nav').outerHeight()-$('#header').outerHeight()-$('#footer').outerHeight()-150;
if (h<400) h=400;
$('div.home-content').height(h);
});
})(jQuery);
</script>
<?php get_footer(); ?>
2 changes: 1 addition & 1 deletion footer.php
Expand Up @@ -2,7 +2,7 @@

</div>
<footer id="footer" class="source-org vcard copyright">
<p>
<p style="display:none;">
<a href="<?php bloginfo('url'); ?>">首页</a>
<span class="sep"> | </span>
<a href="<?php bloginfo('url'); ?>/archives/category/blog">博客</a>
Expand Down
8 changes: 1 addition & 7 deletions header-public.php
@@ -1,10 +1,4 @@
<?php get_header(); ?>
<style type="text/css">
.home-content {
width:800px;
min-height:300px;
}
</style>
<header id="header">
<h1 class="logo entry-title clearfix"><a href="<?php bloginfo('url'); ?>" class="clearfix">
<img src="<?php bloginfo('template_directory'); ?>/_/img/logo.png" width="50" height="50" alt="<?php bloginfo('name'); ?>"/>
Expand All @@ -18,7 +12,7 @@
</a></h1>
</header><!-- #header -->

<div class="home-content page-wrap clearfix">
<div class="home-content clearfix">
<!-- not needed? up to you: http://camendesign.com/code/developpeurs_sans_frontieres -->


4 changes: 3 additions & 1 deletion home.php
Expand Up @@ -7,7 +7,8 @@
<?php get_header('public'); ?>
<script type="text/javascript">
window.$= window.jQuery;</script>
<div id="mainbox" class="grid-m0 col-main">
<div class="content page-wrap grid-m0 clearfix">
<div id="mainbox" class="col-main">
<div class="main-wrap">
<?php if (have_posts()) : ?>
<section id="imagebox">
Expand Down Expand Up @@ -38,6 +39,7 @@
</script>
<?php endif; ?>

</div>
</div>
</div>
<?php get_footer('public'); ?>
Binary file removed screenshot.jpg
Binary file not shown.
Binary file added screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 33 additions & 1 deletion single.php
Expand Up @@ -3,7 +3,39 @@
if (in_category('blog')) {
include (TEMPLATEPATH . '/page.php' );
} else {
include (TEMPLATEPATH . '/category.php');
$name= get_query_var('category_name');
get_header('public');
?>
<div class="content page-wrap grid-m0 clearfix">
<div class="col-main">
<div class="main-wrap clearfix" id="post-<?php the_ID(); ?>">
<?php
if (have_posts()) :
while (have_posts()) : the_post();
?>
<article <?php post_class("clearfix") ?>>
<header>
<h2 class="entry-title" id="post-<?php the_ID(); ?>"><a href="<?php echo $link ?>">
<?php the_title();?>
</a></h2>
<div class="meta">
<?php edit_post_link(__("编辑", 'tbdata'), '<span class="edit-link">', '</span>') ?>
</div>
</header>
<div class="entry">
<?php the_content(); ?>
</div>
</article>
<?php //comments_template(); ?>
<?php endwhile;
// include (TEMPLATEPATH. '/_/inc/nav.php');
?>
<?php endif; ?>
</div>
</div>
</div>
<?php
get_footer('public');
}
}
?>

0 comments on commit 6cb7ff6

Please sign in to comment.