我創建了一個自定義的帖子類型的標誌&文本四行連續。我爲此創建了一個工作後存檔,但現在我需要將這些存檔放入另一個頁面,該頁面在需要顯示自定義帖子類型的位置之前和之後都有其他文本和圖像。什麼是正確的方法來做到這一點?如何將自定義帖子類型添加到WordPress的其他文字/圖形頁面?
我的基本頁面模板:
<?php
/*
Template Name: Work
*/
get_header(); ?>
<div id="body">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
<?php endwhile; endif; ?>
</div>
<?php get_footer(); ?>
這裏是我試圖讓在頁面模板來顯示歸檔PHP:
<?php
get_header();
?>
<div class="post">
<?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) {
?>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<?php } ?>
<div id="body"><h2>Case Studies</h2></div>
<?php while (have_posts()) : the_post(); ?>
<div<?php post_class('margin') ?> id="post-<?php the_ID(); ?>">
<div class="casestudy"><a href="<?php the_permalink() ?>" class="anchor-hover">
<?php echo get_the_post_thumbnail($post->ID, '180,180'); ?>
<span class="details">
<div class="anchor-hover details-h3"><?php the_title(); ?></div>
<p class="desc"><?php echo get_post($post_id)->post_excerpt; ?></p>
</span>
</a>
</div>
<?php endwhile; endif; ?>
<div class="clear"></div>
</div>
</div>
<?php get_footer(); ?>
我推測這段代碼是在Wordpress中? – luiges90
您可以使用高級自定義字段創建_second_內容字段。或者使用簡碼。 – Gant
是的,這是WordPress的 – Chris