i'm working wordpress site , i'm wondering if there way add link each flexslider image when clicked link take user different page within site? have been searching answers hours no luck. code,
<?php /* * template name: home */ get_header(); ?> <div class="content"> <?php $slides = carbon_get_post_meta($post->id, 'slides', 'complex'); if($slides) : ?> <div class="main-slider flexslider"> <ul class="slides"> <?php foreach($slides $slide) : if(empty($slide['image'])) { continue; } ?> <li><img src="<?php echo assante_get_thumb_url($slide['image'], 690, 461); ?>" alt="" /></li> <?php endforeach; ?> </ul> </div> <?php endif; ?> </div> <?php get_footer(); ?>
you can wrap image in link. this:
<div class="flexslider"> <ul class="slides"> <li> <a href='linkto'><img src="slide1.jpg" /></a> </li> </div>
in main page there example (second image).
edit:
//let's have array: <?php $slides = array( array('image' => 'slide1.jpg','link' => 'link1'), array('image' => 'slide2.jpg','link' => 'link2') ); ?> <ul class="slides"> <?php foreach ($slides $slide) : if (empty($slide['image'])) { continue; } ?> <li> <a href="<?php echo $slide['link']?>"> //now have 'link' key match every slide. <img src="<?php echo assante_get_thumb_url($slide['image'], 690, 461); ?>" alt="" /> </a> </li> <?php endforeach; ?> </ul>
Comments
Post a Comment