多个自定义字段导致页面上的双重帖子

时间:2014-08-13 20:58:56

标签: php html post plugins custom-fields

我正在使用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-->

1 个答案:

答案 0 :(得分:0)

我不确定你在问什么,我甚至不擅长这个(PHP)。

但是,如果我看着你的问题,你试图将一个thumnail图像发布到三个不同的div /包装/文件中,然后你的问题是你发布到三个不同的&#34;事情&#34的thumnail图像;不像你期望的那样。我认为解决方案是查看每个类或它们的id然后解决他们的CSS样式。