【发布时间】:2014-08-13 20:58:55
【问题描述】:
我正在使用 Magic Fields 创建分类的图片库。我创建了 3 个不同的自定义字段(port_thumb、illustration_thumb、photo_thumb),以便我可以将我的缩略图图像发布到 3 个不同部分之一。我可以做些什么来将每个帖子与其指定的字段分开吗?基本上,当我为“port_thumb”创建帖子时会发生什么,缩略图会加载,并且该部分中的一切都很好。但随后在其他两个部分的页面下方显示了 port_thumb 的不可见链接,并在该部分的 css 中加载。是否可以添加一些代码来防止每个帖子在页面上显示 3 次?
<?php get_header();
/*Template Name: Portfolio*/
?>
<div id="main">
<!--TYPOGRAPHY-->
<div class="typography">
<div class="title1">
</div>
<ul>
<?php query_posts( 'category_name=portfolio' ); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"
title="Permanent Link to <?php //the_title_attribute(); ?>">
<li><?php echo get_image('port_thumb');?></li>
</a>
<?php endwhile; ?>
<?php //next_posts_link('Older Entries') ?>
<?php //previous_posts_link('Newer Entries') ?>
<?php else : ?>
<?php endif; ?>
</ul>
<!--end typography-->
</div>
<!------ BEGIN ILLUSTRATION-->
<div class="illustration">
<div class="title2">
</div>
<ul>
<?php query_posts( 'category_name=portfolio' ); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"
title="Permanent Link to <?php the_title_attribute(); ?>">
<li><?php echo get_image('illustration_thumb');?></li>
</a>
<?php endwhile; ?>
<?php //next_posts_link('Older Entries') ?>
<?php //previous_posts_link('Newer Entries') ?>
<?php else : ?>
<?php endif; ?>
</ul>
<!--end ILLUSTRATION-->
</div>
<!--- PHOTOGRAPHY--->
<div class="photography">
<div class="title3">
</div>
<ul>
<?php query_posts( 'category_name=portfolio' ); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"
title="Permanent Link to <?php the_title_attribute(); ?>">
<li><?php echo get_image('photo_thumb');?></li>
</a>
<?php endwhile; ?>
<?php //next_posts_link('Older Entries') ?>
<?php //previous_posts_link('Newer Entries') ?>
<?php else : ?>
<?php endif; ?>
</ul>
<!--end image-->
</div>
<!--end main-->
</div>
<!--content end-->
【问题讨论】:
标签: php html post plugins custom-fields