我目前的WordPress主題有一個內置的畫廊。每個圖庫顯示第一個/主要縮略圖,並且一旦點擊,即可在shadowbox中打開該特定圖庫的全部內容。我現在的理想目標是找到一種方法來改變這種情況,而不是直接顯示shadowbox,而是直接指向具有特定畫廊內容的單個頁面。單個頁面上的WordPress畫廊
正如下面我目前的畫廊代碼:
<div id="maincontentwrap">
<div class="main-sep">
</div><!-- .main-sep -->
<div id="contentwrap">
<div id="content-gallery" role="main">
<?php
$wp_query = new WP_Query();
$wp_query->query(array('post_type' => 'galleries', 'posts_per_page' => of_get_option('le_gallery_items'), 'paged' => $paged, 'orderby' => 'menu_order', 'order' => 'ASC'));
$mod = 1;
while ($wp_query->have_posts()) : $wp_query->the_post();
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order'));
if(has_post_thumbnail()) {
$src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
$src = $src[0];
}
else{
foreach ($attachments as $id => $attachment) {
$src = wp_get_attachment_url($id);
}
}
if ($mod % 3 == 0) {
echo ' <div class="gallery-entry-img-last">';
}
else{
echo ' <div class="gallery-entry-img">';
}
?>
<div class="gallery-entry-img-l"><a rel="next" href="<?php echo $src; ?>"><span class="rollover" ></span><img class="blog-entry-img" src="<?php echo get_bloginfo('stylesheet_directory'); ?>/library/tools/timthumb.php?src=<?php echo $src; ?>&w=270&h=198" alt="<?php get_the_title(); ?>"/></a>
<span class="gallery-entry-img-tab"></span>
</div>
<span class="gallery-index-title"><?php the_title(); ?></span>
<div class="hidden-gallery">
<?php
$pic_count = 0;
foreach ($attachments as $id => $attachment) {
$pic_count++;
$others_src = wp_get_attachment_url($id);
?>
<a rel="next" href="<?php echo $others_src; ?>" title="<?php the_title(); ?>"></a>
<?php
}
?>
</div><!-- .hidden-gallery-->
</div>
<?php
$mod++;
endwhile;
?>
<div style="clear:both;"></div>
</div>
</div><!-- #contentwrap-->
</div><!-- #maincontentwrap-->
會有人有一個想法,我怎麼能有這樣的實現?一些專家的建議將被真正讚賞。
哪個WordPress主題?這有助於瞭解可能的解決方案。謝謝。 – donlaur
主題被稱爲「le美食家」 –