2014-01-10 164 views
0

嗨我需要修改我的WP主題,使它顯示最新的帖子標題和兩欄中的特色圖片。顯示兩欄中的WordPress博客文章?

我一直在嘗試幾個小時,但我不能讓它工作,任何建議?

這是博客部分自定義php文件的當前代碼,我可以做一個wipeout並忘記這段代碼,並從頭開始,我已經嘗試過但我無法使它工作...真的很感謝任何提示/建議。 ..我不是專家,我正在學習:)

<div class="main-container"> 
      <div class="main wrapper clearfix"> 



<?php if (have_posts()) while (have_posts()) : the_post(); ?> 


<aside class="left"></aside> 
<article> 
    <h1><?php the_title(); ?></h1> 
<?php endwhile; ?> 


<ul class="posts"> 

<?php 
if (get_query_var('paged')) { $paged = get_query_var('paged'); } 
elseif (get_query_var('page')) { $paged = get_query_var('page'); } 
else { $paged = 1; } 

query_posts('cat=9&posts_per_page=10&&paged=' . $paged); 
?> 
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
    <li> 

     <h2><?php the_title(); ?></h2><span class="tags"><?php 
$posttags = get_the_tags(); 
if ($posttags) { 
    foreach($posttags as $tag) { 
    echo $tag->name . ' '; 
    } 
} 
?></span> 
    <time datetime="<?php the_time('Y-m-d'); ?>" pubdate><?php the_time('j F Y'); ?></time> 

    <?php global $more; 
    $more = 0; 
    the_content('Read more'); ?> 


    </li> 
<?php endwhile; endif; ?> 

</ul> 

<div class="pagination"> 
<?php 
global $wp_query; 

$big = 999999999; // need an unlikely integer 

echo paginate_links(array(
    'base' => str_replace($big, '%#%', get_pagenum_link($big)), 
    'format' => '?paged=%#%', 
    'current' => max(1, get_query_var('paged')), 
    'total' => $wp_query->max_num_pages 
)); 
?></div> 

</article-blog> 
+0

別不要使用query_posts,而應使用WP_Query –

回答

0

難道你不只是這樣做與CSS?只需將所有的LI設置爲(例如)width:50%;,然後將它們全部左移,並將它們並排放置在兩列布局中。

li { 
    display:block; 
    width:50%; 
    float:left; 
} 
相關問題