gpt4 book ai didi

javascript - 带有缩略图的 WordPress 扩展网格

转载 作者:行者123 更新时间:2023-11-28 07:39:59 24 4
gpt4 key购买 nike

我正在使用 codrops 解决方案在扩展网格中显示团队成员:http://tympanus.net/codrops/2013/03/19/thumbnail-grid-with-expanding-preview/

我已经能够更改一些代码以在网格预览中显示我的帖子缩略图。但是,我想在展开 View 中以全尺寸显示相同的图片。在原始版本中,它会在名为 1.jpg 的文件中抓取图像。如何实现抓取我的缩略图?

这是我的 PHP/HTML:

<ul id="og-grid" class="og-grid">
<?php $args = array( 'post_type' => 'mitarbeiter');
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li>
<a href="mailto:<?php the_field('email')?>" data-largesrc="images/1.jpg" data-title="<?php the_title(); ?>" data-description="<?php the_field('funktion') ?><br /><br />Rufen Sie mich an unter <?php the_field('telefonnummer')?> oder schreiben Sie mir eine Nachricht.">

<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('team');
}
else { } ?>
</a>
<?php the_title(); ?>

</li>
<?php endwhile; ?>

原始 CSS 只是稍作改动以满足我的需要:https://github.com/codrops/ThumbnailGridExpandingPreview/blob/master/css/component.css

原始 JS 没有变化:https://github.com/codrops/ThumbnailGridExpandingPreview/blob/master/js/grid.js

最佳答案

请查看您的代码:

data-largesrc="images/1.jpg"

将此更改为您的缩略图网址。

关于javascript - 带有缩略图的 WordPress 扩展网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30997537/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com