自定义Wordpress主题php在源代码中处理,但不在页面上处理
我正在为我的投资组合创建一个自定义WP主题。我在任何地方都找不到解决这个问题的办法。我已经设置了一个带有循环的自定义页面,在我的主页上以网格格式显示我的公文包帖子。我希望我的文章在使用默认索引模板的地方以全文而不是网格格式显示。我已经让网格工作了,但是博客页面没有显示我的帖子。奇怪的是,当我查看我的源代码时,文章内容显示在源代码中,但它只是不显示在页面上。我调整了阅读设置,多次重置永久链接,停用了所有插件,甚至完全重新安装了Wordpress。看起来我可能遗漏了一些显而易见的东西,但我无法理解,这让我很沮丧。任何人能提供的任何帮助都将不胜感激 我的网格循环:自定义Wordpress主题php在源代码中处理,但不在页面上处理,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我正在为我的投资组合创建一个自定义WP主题。我在任何地方都找不到解决这个问题的办法。我已经设置了一个带有循环的自定义页面,在我的主页上以网格格式显示我的公文包帖子。我希望我的文章在使用默认索引模板的地方以全文而不是网格格式显示。我已经让网格工作了,但是博客页面没有显示我的帖子。奇怪的是,当我查看我的源代码时,文章内容显示在源代码中,但它只是不显示在页面上。我调整了阅读设置,多次重置永久链接,停用了所有插件,甚至完全重新安装了Wordpress。看起来我可能遗漏了一些显而易见的东西,但我无法理解,
<?php
/*
Template Name: Home
*/
?>
`<?php get_header(); ?>
<div id="content" class="group">
<div id="gridcontainer">
<?php
$counter = 1; //start counter
$grids = 2; //Grids per row
global $query_string; //Need this to make pagination work
/*Setting up our custom query (In here we are setting it to show 12 posts per page and eliminate all sticky posts) */
query_posts($query_string . '&caller_get_posts=1&posts_per_page=12');
if(have_posts()) : while(have_posts()) : the_post();
?>
<?php
//Show the left hand side column
if($counter == 1) :
?>
<div class="griditemleft">
<div class="postimage">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('category-thumbnail'); ?></a>
</div>
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
</div>
<?php
//Show the right hand side column
elseif($counter == $grids) :
?>
<div class="griditemright">
<div class="postimage">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('category-thumbnail'); ?></a>
</div>
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
</div>
<div class="clear"></div>
<?php
$counter = 0;
endif;
?>
<?php
$counter++;
endwhile;
//Pagination can go here if you want it.
endif;
?>
</div>
</div>
<?php get_footer(); ?>`
和我的索引页循环:
<?php get_header(); ?>
<div id="content" class="group">
<article>
<?php // Display blog posts on any page @ http://m0n.co/l
$temp = $wp_query; $wp_query= null;
$wp_query = new WP_Query(); $wp_query->query('showposts=5' . '&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="post-header">
<h1><?php the_title(); ?></h1>
</div><!--end post header-->
<div class="entry clear">
<?php if ( function_exists( 'add_theme_support' ) ) the_post_thumbnail(); ?>
<?php echo get_template_part(); ?><?php the_content(); ?>
<?php edit_post_link(); ?>
<?php wp_link_pages(); ?>
</div><!--end entry-->
</div><!--end post-->
<?php endwhile; ?>
<?php if ($paged > 1) { ?>
<nav id="nav-posts">
<div class="prev"><?php next_posts_link('« Previous Posts'); ?></div>
<div class="next"><?php previous_posts_link('Newer Posts »'); ?></div>
</nav>
<?php } else { ?>
<nav id="nav-posts">
<div class="prev"><?php next_posts_link('« Previous Posts'); ?></div>
</nav>
<?php } ?>
<?php wp_reset_postdata(); ?>
</article>
</div>
<?php get_footer(); ?>
如果html在视图源代码中可见,但在页面上不呈现,则需要查找损坏/无效的html或错误的css规则。感谢您的回复。我现在浏览每一页。仍然无法找到问题,它确实验证了,但我还没有完成。显然,我应用于容器div的font-size:0标记导致了此问题。再次感谢你的帮助。