简体   繁体   English

WordPress自定义主题,为什么我的内容没有显示在页面上

[英]WordPress custom theme, Why is my content not showing on page

My pages are not showing any content on them other then the header and footer I think its something to do with the way i am laying out my but don't really know. 除页眉和页脚之外,我的页面上没有显示其他内容,我认为这与我布局我的方式有关,但我并不十分了解。

index.php and page.php index.php和page.php

<?php get_header(); ?>
<?php if( have_posts() ) : the_post(); ?>
    <?php the_content(); ?>
<?php endif; ?>
<?php get_footer(); ?>

You forgot while statement. 你忘了while声明。

Here's how your code should look: 这是代码的外观:

<?php get_header(); ?>
<?php if( have_posts() ) : while ( have_posts() ) :  the_post(); ?>
    <?php the_content(); ?>
<?php endwhile; endif; ?>
<?php get_footer(); ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WordPress 显示内容的自定义主题错误 - WordPress custom theme errors with showing content 如何在Wordpress中以自定义主题显示页面内容? - How to display page content in custom theme in wordpress? Woocommerce 未在我的自定义主题中显示标签内容 - Woocommerce not showing tab content in my custom theme 从头开始 wordpress 主题未显示 page.php 的页面内容 - Scratch wordpress theme is not showing page content for page.php Wordpress中的Minimatica主题使页面宽于内容,并显示滚动条 - Minimatica theme in wordpress makes the page wider than the content, showing a scrollbar Wordpress - 自定义主题 - 模板名称未在页面属性中显示模板 - Wordpress - Custom theme - Template Name not showing Template in Page Attributes 为什么我的WordPress自定义主题页面中没有显示图片库插件的oputput? - Why the oputput of an image gallery plugin is not displayed into a page of my WordPress custom theme? 小部件标题未显示在我的自定义 WordPress 主题中 - Widget title not showing up in my custom WordPress theme 为什么我的wordpress主题中的分页没有显示(wp-paginate插件) - why pagination in my wordpress theme is not showing (wp-paginate plugin) 页面内容未显示在一个主题中 - Page content not showing in one theme
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM