Wordpress主题灯箱缩略图


Wordpress theme lightbox thumbnail

所以,我的wordpress主题中基本上有这段代码,它为库中的图像创建了一个容器,上面有两个图标作为覆盖。第一个图标是灯箱图库图标,这是我感兴趣的一个,另一个是类似按钮。

我想做的是消除灯箱之类的按钮,让整个缩略图使用灯箱,而不是重定向到项目页面。

我尝试更改链接到项目页面的图像的href以加载lightbox,但失败了。

如果你知道怎么做,请告诉我!

$html .=" " . $masonry_size;
            $html .="'>";
            $html .= "<div class='image_holder'>";
            $html .= "<a class='portfolio_link_for_touch' href='".$portfolio_link."' target='".$target."'>";
            $html .= "<span class='image'>";
            $html .= get_the_post_thumbnail(get_the_ID(), $image_size);
            $html .= "</span>"; //close span.image
            $html .= "</a>"; //close a.portfolio_link_for_touch
            $html .= "<span class='text_holder'>";
            $html .= "<span class='text_outer'>";
            $html .= "<span class='text_inner'>";
            $html .= '<div class="hover_feature_holder_title">';
            $html .= '<div class="hover_feature_holder_title_inner">';
            $html .= '<'.$title_tag.' '.$title_styles.' class="portfolio_title"><a href="' . $portfolio_link . '" '.$title_styles.' target="'.$target.'">' . get_the_title() . '</a></'.$title_tag.'>';
            $html .= $separator_html;
            $html .= '<span '.$category_style.' class="project_category">';
            $k = 1;
            foreach ($terms as $term) {
                $html .= "$term->name";
                if (count($terms) != $k) {
                    $html .= ', ';
                }
                $k++;
            }
            $html .= '</span>'; //close span.project_category
            $html .= '</div>'; //close div.hover_feature_holder_title_inner
            $html .= '</div>'; //close div.hover_feature_holder_title
            $html .= "<span class='feature_holder'>";
            $html .= '<span class="feature_holder_icons">';
            if ($lightbox == "yes") {
                $html .= "<a class='lightbox hover_icon_holder' title='" . $title . "' href='" . $large_image . "' data-rel='prettyPhoto[" . $slug_list_ . "]'><span ".$features_icons_styles." class='hover_icon icon_search'></span></a>";
            }
            $html .= "<a class='preview hover_icon_holder' href='" . $portfolio_link . "' target='".$target."'><span ".$features_icons_styles." class='hover_icon icon_link_alt'></span></a>";
            if ($portfolio_qode_like == "on") {
                $html .= "<span ".$features_icons_styles." class='portfolio_like hover_icon_holder'>";
                if (function_exists('qode_like_portfolio_list')) {
                    $html .= qode_like_portfolio_list(get_the_ID());
                }
                $html .= "</span>";
            }
            $html .= "</span>"; //close span.feature_holder_icons
            $html .= "</span>"; //close span.feature_holder
            $html .= "</span>"; //close span.text_inner
            $html .= "</span>"; //close span.text_outer
            $html .= "</span>"; //close span.text_holder
            $html .= "</div>"; //close div.image_holder
            $html .= "</article>";
        endwhile;
        else:
            ?>

我不确定主题的其余部分是什么样子,但我在这里尝试一下。我认为触发灯箱的是决定在灯箱中查看哪个图像的代码:

class='lightbox hover_icon_holder' title='" . $title . "' href='" . $large_image . "' data-rel='prettyPhoto[" . $slug_list_ . "]'

因此,我们将把这部分移到代码的外部链接。我还从您的代码中删除了这两个按钮。我认为它变成这样:

$html .=" " . $masonry_size;
        $html .="'>";
        $html .= "<div class='image_holder'>";
        $html .= "<a class='portfolio_link_for_touch lightbox' href='".$large_image."' data-rel='prettyPhoto[" . $slug_list_ . "]' target='".$target."'>";
        $html .= "<span class='image'>";
        $html .= get_the_post_thumbnail(get_the_ID(), $image_size);
        $html .= "</span>"; //close span.image
        $html .= "</a>"; //close a.portfolio_link_for_touch
        $html .= "<span class='text_holder'>";
        $html .= "<span class='text_outer'>";
        $html .= "<span class='text_inner'>";
        $html .= '<div class="hover_feature_holder_title">';
        $html .= '<div class="hover_feature_holder_title_inner">';
        $html .= '<'.$title_tag.' '.$title_styles.' class="portfolio_title"><a href="' . $portfolio_link . '" '.$title_styles.' target="'.$target.'">' . get_the_title() . '</a></'.$title_tag.'>';
        $html .= $separator_html;
        $html .= '<span '.$category_style.' class="project_category">';
        $k = 1;
        foreach ($terms as $term) {
            $html .= "$term->name";
            if (count($terms) != $k) {
                $html .= ', ';
            }
            $k++;
        }
        $html .= '</span>'; //close span.project_category
        $html .= '</div>'; //close div.hover_feature_holder_title_inner
        $html .= '</div>'; //close div.hover_feature_holder_title
        $html .= "</span>"; //close span.text_inner
        $html .= "</span>"; //close span.text_outer
        $html .= "</span>"; //close span.text_holder
        $html .= "</div>"; //close div.image_holder
        $html .= "</article>";
    endwhile;
    else:
        ?>