亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

mixitup 動態圖像的放大彈出問題

mixitup 動態圖像的放大彈出問題

PHP
aluckdog 2023-07-08 17:51:28
我只是在我的網站中手動設置同位素,然后在 get_terms 和 get_ther_terms 條件的幫助下動態它,這里是完整的代碼     <div class="main_page"><div class="portfolio_section">          <div class="controls">       <button type="button" class="control" data-filter="all">All</button>        <?php          $cat_list = get_terms('filters');          foreach ($cat_list as $cat) :          ?>    <button type="button" class="control" data-filter=".<?php echo $cat->slug;?>"><?php echo $cat->name; ?></button>      <?php endforeach; ?>     </div>   <div class="container pasresnt">     <?php         $mixitup = new WP_Query(array(             'post_type' => 'portfolio',             'posts_per_page' => -1,         ));     ?>           <?php while ($mixitup->have_posts()) : $mixitup->the_post() ; ?><div class="mix <?php           $cat_slug = get_the_terms($post->ID, 'filters');           foreach ($cat_slug as $cat_sl) {            echo $cat_sl->slug;           }           ?>">            <a href="<?php the_post_thumbnail('portfolio-small'); ?>" target="_blank"><?php the_post_thumbnail('portfolio-small'); ?> </a>         </div> <?php endwhile; ?>         <div class="mix green">      <a href="<?php echo get_template_directory_uri(); ?>/img/mahi.jpg"><img src="<?php echo get_template_directory_uri(); ?>/img/mahi.jpg"alt=""></a></div></div> </div> </div>這是正常靜態圖像彈出窗口中的亮點,此代碼正確顯示 <a href="<?php echo get_template_directory_uri(); ?>/img/mahi.jpg"><img src="<?php echo get_template_directory_uri(); ?>/img/mahi.jpg"alt=""></a>但在動態中,此圖像彈出窗口對我不起作用。最后一個靜態圖像作為示例,工作完美,但這行代碼是圖像來自投資組合自定義帖子選項,此彈出窗口不起作用<a href="<?php echo $for_img; ?>" target="_blank"><?php the_post_thumbnail('portfolio-small'); ?> </a>`
查看完整描述

1 回答

?
弒天下

TA貢獻1818條經驗 獲得超8個贊

您正在the_post_thumbnail使用href. 這會輸出 html 來顯示圖像,但您只想將 URL 放入href鏈接的屬性中,因此請改用get_the_post_thumbnail_url()。


所以代替這個:


<a href="<?php the_post_thumbnail('portfolio-small'); ?>" target="_blank"><?php the_post_thumbnail('portfolio-small'); ?> </a>

你應該使用這個:


<a href="<?php echo get_the_post_thumbnail_url(get_the_ID(), 'portfolio-small'); ?>" target="_blank">

    <?php the_post_thumbnail('portfolio-small'); ?>

</a>


查看完整回答
反對 回復 2023-07-08
  • 1 回答
  • 0 關注
  • 137 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號