2013-08-21 58 views
0

我使用灯箱插件使用rel =“lightbox”来激发我使用高级自定义字段plugin创建的库中的灯箱。所有的作品很好,直到我想添加一个绝对定位在盒子div中的子div。它应该改变悬停的不透明度,仍然有灯火。为什么灯箱不工作时,div有一个孩子div

我的标记

<?php if(get_field('image')): 
    $attachment_id = get_field('image'); 
    $size = "full"; 
    $image = wp_get_attachment_image_src($attachment_id, $size); 
    $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); 
    $image_title = $attachment->post_title; 
    $caption = $attachment->post_excerpt; 
    ?> 
    <a href="<?php echo $image[0]; ?>" rel="lightbox"><?php echo wp_get_attachment_image($attachment_id, medium); ?> </a> 
     <div class="hover-title"> 
    <?php the_field('hover_title');?> 
    </div><!-- hover title --> 
    <?php endif; ?> 
    </div><!-- box --> 

如果我只是删除 “悬停标题” 收藏的作品。但我想用:) :)

我的css: .box a { margin:5px; float:left; 位置:相对; 溢出:隐藏; 不透明度:1; display:block; }

回答

0

是完整的代码。如果是这样,那么你错过了一个开放<div>

仅供参考你的头两行应该读

$attachment_id = get_field('image'); 
if ($attachment_id) { 

} 

不需要调用get_field()的两倍,它是一个数据库调用毕竟。

好运

相关问题