你只需要在添加的rel = 「收藏夾」 燈箱功能一個像這樣的href:
<a rel="lightbox" href="<?php echo wp_get_attachment_url($post->ID); ?>" title="<?php echo wp_specialchars(get_the_title($post->ID), 1) ?>"><?php echo wp_get_attachment_image($post->ID, 'large'); ?></a>
除此之外,我建議你可以通過你正在使用的燈箱的演示/教程/文檔。它也需要包含適當的js和文件。你還需要使用簡單的jquery代碼來初始化它。像這樣:
<script type="text/javascript">
$(function() {
// Use this example, or...
$('a[@rel*=lightbox]').lightBox(); // Select all links that contains lightbox in the attribute rel
// This, or...
$('#gallery a').lightBox(); // Select all links in object with gallery ID
// This, or...
$('a.lightbox').lightBox(); // Select all links with lightbox class
// This, or...
$('a').lightBox(); // Select all links in the page
// ... The possibility are many. Use your creative or choose one in the examples above
});
</script>
您可以參考文檔以瞭解燈箱腳本的確切示例。
我做了所有這一切,但它仍然不起作用 – 2012-02-27 11:41:15
會發生什麼,你能分享你的網頁網址嗎? – Krunal 2012-05-04 11:25:21