如何将花式框id与包含描述的div连接起来



我在这里试图实现的是让fancybox打开一个带有图像/标题/描述的模块。

到目前为止,我遇到的唯一问题是,我试图添加的每个成员的数据要么相同,要么根本没有显示。

<?php $loop = new WP_Query( array( 'post_type' => 'thegem_team_person', 'posts_per_page' => -1, 'category' => 'current' ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="col-lg-4 col-md-4">
                **<a class="fancybox" href="#link">**<img src="<?php echo $picturedy;?>">
                    <h3 style="padding-top: 20px; text-decoration: none; color: #333;"><?php the_title();?></h3>
                    <p style="color: #11a9d4; padding-bottom: 10px; text-decoration: none;"> <?php the_title();?> </p></a>
                 <div id="#link"> 
                     
                     <h3 style="padding-top: 20px; text-decoration: none; color: #333;"><?php the_title();?></h3>
                    <?php $dscp = get_field('description');
                  echo $dscp;?> 
                 
                 </div>
                
     
              </div>                    
<?php endwhile; wp_reset_query(); ?>

我想做的是,当你点击<a class="fancybox" href="#"></a>将弹出带有#link-id的div。我只有机会用html做这件事。在那里,我必须逐一登记每个人。

我希望我说得很清楚,很抱歉发了这么长的帖子。

这是我找到的解决方案,以备将来有人需要。

<?php $loop = new WP_Query( array( 
'post_type' => 'name_of_the_custom_post_type',  
'posts_per_page' => -1, 
'category' => 'current' ) ); 
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="col-lg-4 col-md-4">
  <a class="fancybox" href="#team<?php echo get_the_ID(); ?>"><?php the_post_thumbnail();?>
     <h3><?php the_title();?></h3>
    <p> <?php the_title();?> </p>
  </a>
  <div> 
<div id="team<?php echo get_the_ID(); ?>">
<h3 class="fancy-box-title"><?php the_title();?></h3>
<p><?php $dscp = get_field('description');
     echo $dscp;?> </p>
     </div>
        </div>
            </div>      
<?php endwhile; wp_reset_query(); ?>

部件get_field('description'(是我用高级自定义字段创建的字段。

相关内容

最新更新