2015-02-07 84 views
1

我正在創建一個新聞中心,其中包含指定類別的最新wordpress帖子。它包括帖子圖片和標題。該div組有一個懸停動畫,我希望這個類,當點擊時,鏈接到它的拉動標題和圖像的帖子。將div組鏈接到選定的永久鏈接?

目前它只鏈接,如果你點擊標題本身,我希望能夠點擊整個塊,並鏈接到帖子。有任何想法嗎?這裏是代碼,因爲它代表...

<?php query_posts('cat=1 &posts_per_page=1'); ?> 
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
    <div class="block-1"> 
     <div class="news-center-overlay transition"> 
     <p>VIEW FULL STORY</p> 
      <div id="news-line-box"> 
      <div id="part-1"></div><div id="part-2"><img src="<?php echo get_stylesheet_directory_uri()?>/img/star.png"/> </div><div id="part-3"></div> 
      </div> 
      <h4>COMETS BASKETBALL</h4> 
     </div> 

     <a href="<?php the_permalink() ?>"><?php echo get_the_post_thumbnail($post_id, $size, $attr); ?></a> 

     <p class="news-center-title animation"><a href="<?php the_permalink() ?>"><?php echo get_the_title($ID); ?></a></p> 
    </div> 
<?php endwhile; endif; ?> 

回答

0

從我的理解,您是想點擊一個塊與鏈接到駐留在塊

後如果是這樣的情況下,塊可以包裝在href鏈接中,或者href鏈接可以包裝到news-center-overlay

<?php query_posts('cat=1 &posts_per_page=1'); ?> 
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
    <a href="<?php the_permalink(); ?>"> 
     <div class="block-1"> 
      <div class="news-center-overlay transition"> 
      <p>VIEW FULL STORY</p> 
       <div id="news-line-box"> 
       <div id="part-1"></div><div id="part-2"><img src="<?php echo get_stylesheet_directory_uri()?>/img/star.png"/> </div><div id="part-3"></div> 
       </div> 
       <h4>COMETS BASKETBALL</h4> 
      </div> 

      <?php echo get_the_post_thumbnail($post_id, $size, $attr); ?> 

      <p class="news-center-title animation"><a href="<?php the_permalink() ?>"><?php echo get_the_title($ID); ?></a></p> 
     </div> 
    </a> 
    <?php endwhile; endif; ?>