0
我想使頁面的帖子基於the example from wordpress codex。 我正在使用美麗的WP主題(Radcliffe),並沒有成功地將它與上述示例結合起來。WordPress的頁面的問題
我創建的頁面的確的工作,但職位是重疊的,一個在另一個。在它下面有很多空白區域,最後是頁面底部的頁腳。
我的頁面看起來像現在:
<?php get_header(); ?>
<div class="content">
<?php
if (have_posts()) :
while (have_posts()) : the_post();
get_template_part('content', get_post_format());
wp_reset_postdata();
endwhile;
endif;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'category_name' => 'testy',
'paged' => $paged
);
$list_of_posts = new WP_Query($args);
?>
<?php if ($list_of_posts->have_posts()) : ?>
<?php /* The loop */ ?>
<?php while ($list_of_posts->have_posts()) : $list_of_posts->the_post(); ?>
<?php // Display content of posts ?>
<?php get_template_part('content', get_post_format()); ?>
<?php endwhile; ?>
<div class="posts">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$total_post_count = wp_count_posts();
$published_post_count = $total_post_count->publish;
$total_pages = ceil($published_post_count/$posts_per_page);
if ("1" < $paged) : ?>
<div class="page-title section small-padding">
<h4 class="section-inner"><?php printf(__('Page %s of %s', 'radcliffe'), $paged, $wp_query->max_num_pages); ?></h4>
</div>
<div class="clear"></div>
<?php endif; ?>
<?php while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php get_template_part('content', get_post_format()); ?>
</div>
<?php endwhile; ?>
<?php if ($wp_query->max_num_pages > 1) : ?>
<div class="archive-nav">
<?php echo get_next_posts_link('« ' . __('Older posts', 'radcliffe')); ?>
<?php echo get_previous_posts_link(__('Newer posts', 'radcliffe') . ' »'); ?>
<div class="clear"></div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>
可能有人請告訴我我的錯誤?
聽起來像一個CSS問題,而不是PHP的問題。 – rnevius 2014-11-08 15:26:02
那麼你能告訴我上面引用的php代碼不包含任何錯誤嗎?我不是PHP中的老鷹。 – anka 2014-11-08 15:28:47