【发布时间】:2012-01-30 00:57:14
【问题描述】:
我想知道的是,如何实现我已经制作的 index.php 文件以将自定义帖子应用到它。 (见下文)
我想要完成的事情:
Display all posts(already accomplished in index.php)
--> show normal post a.k.a 'Article' (already accomplished in index.php)
If category/or post type 'Aside' is used, don't apply a <a> tag, make title lighter(can figure it out in CSS)
-->show text for the 'Aside' marked post
If category/or post type 'Link' is used, wrap title in <a> tag linking to a site(<-- how would I do that in WordPress?)
-->show text for info about the link
If category/or post type 'Photo' is used, don't wrap title in a <a> tag
-->show attached image in post, and post text as a caption
我知道这可能看起来很多,但我相信它很容易做到。
有些源代码可能对我没有帮助,所以我在下面有我的 index.php 看看你是否可以帮我实现它:
<?php get_header(); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<article>
<!-- <p><span class="metaCat"><?php the_category(', '); ?></span></p> -->
<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
<p><span class="meta"><?php the_time('F jS, Y') ?></span></p>
<hr />
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
</div>
</article>
<hr class="big" />
<?php endwhile; ?>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php include (TEMPLATEPATH . "/searchform.php"); ?>
<?php endif; ?>
如果您可以将所需的代码输入到一个可行的 index.php 文件中,您将得到一些深思熟虑的布朗尼积分!
谢谢,欢迎所有帮助!
【问题讨论】:
标签: php wordpress custom-post-type