【问题标题】:Multiple custom fields causing double posts on page多个自定义字段导致页面上出现双重帖子
【发布时间】: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


    【解决方案1】:

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

    但是,如果我看到您的问题,您正在尝试将缩略图图像发布到三个不同的 div/包装器/文件中,然后您的问题是您发布到这三个不同“事物”中的缩略图图像与你期望。我认为解决方案是查看它们的每个类或 id,然后解决它们的 CSS 样式。

    【讨论】:

    • 基本上是的,有三个不同的 div。 div A、B 和 C。它们都位于同一页面上。每个都包含一个自定义字段。 A 有 port_thumb,B 有 illustration_thumb,C 有 photo_thumb。假设我正在发帖,我想向 A 添加新缩略图。我添加新帖子并将图像上传到 port_thumb。帖子将顺利通过,并且在 div A 中,缩略图将是完美的。但是当我向下滚动页面到 div B 和 C 所在的位置时,A 的帖子就会显示出来。缩略图本身不可见,但在缩略图大小的空间中有一个活动链接。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-25
    • 2014-05-30
    • 2016-11-14
    • 1970-01-01
    • 1970-01-01
    • 2013-10-10
    相关资源
    最近更新 更多