您好我是wordpress的新手,我正在尝试为网站创建自己的自定义主题,我理解我所做的一些但我必须承认,有些东西对我来说仍然很奇怪 . 我现在的问题是,当我添加一个新页面并且我向该页面添加内容时,当我访问该网站时内容不会显示但页眉和页脚显示正常,我已检查了源代码和注意到内容没有生成 .
这些是我的custom themefile的代码文件:
[header.php文件]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/menu.css" type="text/css" />
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
</head>
<body>
<div id="header">
<div class="content">
<div id="logo-with-contact">
<img src="<?php bloginfo('template_url') ?>/images/Amissah, Amissah - Logo.png" alt="Amissah, Amissah & Co" id="header-image" />
<div class="clear"></div>
</div>
</div>
<nav id="top-menu-nav">
<ul>
<li><a href="<?php echo get_option('home') ?>">Home</a></li>
<?php echo wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
</ul>
</nav>
</div>
<div class="clear"></div>
[Footer.php]
<div id="footer">
<div class="content">
<div class="block" style="margin-left: 0px">
<h3>Quick Links</h3>
<ul>
<li><a href="our-firm.html">Our Firm</a></li>
<li><a href="our-practices.html">Our Practices</a></li>
<li><a href="resources.html">Resources</a></li>
</ul>
</div>
<div class="block">
<h3>About Us</h3>
<ul>
<!--<li><a href="corporate-info.html">Corporate Info</a></li>-->
<li><a href="staff.html">Staff</a></li>
<li><a href="testimonials.html">Testimonials</a></li>
</ul>
</div>
<div class="block">
<h3>Stay Connected</h3>
<ul>
<li><a href="#" title="facebook"><img src="<?php bloginfo('template_url') ?>/images/facebook-icon.png" alt="facebook" /> Join us on facebook</a></li>
<li><a href="#" title="twitter"><img src="<?php bloginfo('template_url') ?>/images/twitter-icon.png" alt="twitter" /> Follow us on twitter</a></li>
<li><a href="https://login.secureserver.net/index.php?app=wbe" title="mail"><img src="<?php bloginfo('template_url') ?>/images/E-Mail.png" alt="staff mail" /> Staff Email</a></li>
</ul>
</div>
<div class="block" style="width:220px; line-height: 18px;">
<h3>Contact Us</h3>
Email: info@example.com
Location: xxxxx-xxxxx Memorial Court,
F xxx/5, xth xxxxx Street,
xxxx xxxx Avenue, xxxx,
Adjacent the xxxx xxxxxx Embassy,
Accra
Telephone: xxxx xxx xxx </div>
<div class="clear">
</div>
<div class="horizontal-divider"></div>
</div>
</div>
</body>
</html
[的index.php]
<?php get_header(); ?>
<div id="main" class="site-main">
<div class="content">
</div>
</div>
<?php get_footer(); ?>
3 回答
按照WordPress,
The Loop 是WordPress用于显示帖子的PHP代码 . 使用The Loop,WordPress处理每个帖子以显示在当前页面上,并根据它与The Loop标签中指定条件的匹配方式对其进行格式化 . 循环中的任何HTML或PHP代码都将在每个帖子上处理 .
可以在这里找到,http://codex.wordpress.org/The_Loop
基本上,“循环”是WordPress的动态部分,它会吐出页面,帖子和其他内容 .
看起来你错过了循环,这是wordpress用来遍历传递给模板并呈现内容的任何帖子/页面 .
尝试将此添加到内容div中的index.php
你可以在这里阅读所有相关信息 - http://codex.wordpress.org/The_Loop
将以下COde放在index.php之后