admin管理员组文章数量:1390503
I'm combining fancybox(jquery) with multiple post thumbnail plugin. Basically the idea is when the user click the featured image post it will display the image on the secondary featured image. Here is the code that i'm working on.
<?php query_posts('posts_per_page=-1&cat=10'); if(have_posts()) : while(have_posts()) :the_post(); ?>
<div class="collections_thumbnails">
<a class="fancybox" href="<?php MultiPostThumbnails::get_the_post_thumbnail(get_post_type, 'secondary-image'); ?>"><?php if ( has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large'); echo '<img src="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '">'; } ?></a>
<div class="hover_dress">
<h3><a class="dress_title" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
</div>
</div>
<?php endwhile; endif; wp_reset_query();?>
The problem right now whenever i click the featured, it displays the featured image in the fancybox instead of the secondary image and the featured image disappears once i close the fancybox. Has anyone tried this approach when creating post featured image with fancybox.
Here is a screenshot of what the output looks like
and here is a screen shot of what is set in the secondary image
This is the link for the website i'm building at the moment -
/?page_id=8
.jpg
I'm combining fancybox(jquery) with multiple post thumbnail plugin. Basically the idea is when the user click the featured image post it will display the image on the secondary featured image. Here is the code that i'm working on.
<?php query_posts('posts_per_page=-1&cat=10'); if(have_posts()) : while(have_posts()) :the_post(); ?>
<div class="collections_thumbnails">
<a class="fancybox" href="<?php MultiPostThumbnails::get_the_post_thumbnail(get_post_type, 'secondary-image'); ?>"><?php if ( has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large'); echo '<img src="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '">'; } ?></a>
<div class="hover_dress">
<h3><a class="dress_title" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
</div>
</div>
<?php endwhile; endif; wp_reset_query();?>
The problem right now whenever i click the featured, it displays the featured image in the fancybox instead of the secondary image and the featured image disappears once i close the fancybox. Has anyone tried this approach when creating post featured image with fancybox.
Here is a screenshot of what the output looks like
and here is a screen shot of what is set in the secondary image
This is the link for the website i'm building at the moment -
http://digitalspin.ph/pluma/?page_id=8
http://i255.photobucket/albums/hh140/testament1234/second-image_zpsfb2bd810.jpg
Share Improve this question asked Jan 14, 2014 at 8:34 clestcruzclestcruz 2011 gold badge6 silver badges13 bronze badges 1- Could you rewrite your question? It's not really clear what you're asking. – Kay van Bree Commented Jan 14, 2014 at 10:50
1 Answer
Reset to default 0I managed to get the result on my own after much playing with the codes. Here is the working code :)
<div class="collections_dresses_container">
<?php query_posts('posts_per_page=-1&cat=10'); if(have_posts()) : while(have_posts()) :the_post(); ?>
<div class="collections_thumbnails">
<?php
$imgID = get_post_thumbnail_id();
$url = MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'secondary-image');
?>
<?php if ( has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo '<a class="fancybox" href="' . $large_image_url[0] . '"><img src="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '"></a>'; } ?>
<div class="hover_dress">
<a class="fancybox" href="<?php echo $url; ?>"><span><?php the_title(); ?></span></a>
</div>
<?php /*
<div class="hover_dress">
<h3><a class="dress_title" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
</div>
*/ ?>
</div>
<?php endwhile; endif; wp_reset_query();?>
</div>
本文标签: phpCombining fancybox with multiple thumbnail plugin
版权声明:本文标题:php - Combining fancybox with multiple thumbnail plugin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744690078a2619941.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论