2014-05-18 42 views
0

我正在实施投资组合页面模板,但是我想删除所有投资组合图片背后的URL。 (见下面的页面温度) 示例网站:http://demo.fabthemes.com/adament/my-portfolio/

任何人都可以帮我删除URL吗?一旦我删除$ img_url部分,我的投资组合就不会显示。

<?php 
/** 
* The template for displaying all pages. 
* 
* This is the template that displays all pages by default. 
* Please note that this is the WordPress construct of pages 
* and that other 'pages' on your WordPress site will use a 
* different template. 

Template name:Portfolio 
* 
* @package fabframe 
*/ 

get_header(); ?> 

<div class="full-wrap"> 
<ul class="folio-grid stylefx"> 
     <?php 
     if (get_query_var('paged')) 
      $paged = get_query_var('paged'); 
     elseif (get_query_var('page')) 
      $paged = get_query_var('page'); 
     else 
      $paged = 1; 
     $wp_query = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' =>-1)); 
     ?> 

     <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> 

     <li> 

      <figure> 
       <?php 
        $thumb = get_post_thumbnail_id(); 
        $img_url = wp_get_attachment_url($thumb,'full'); //get full URL to image (use "large" or "medium" if the images too big) 
        $image = aq_resize($img_url,720, 480, true); //resize & crop the image 
       ?> 

       <?php if($image) : ?> 
        <a href="<?php the_permalink(); ?>"><img class="img-responsive" src="<?php echo $image ?>"/></a> 
       <?php endif; ?> 

      <figcaption> 
       <h3><?php the_title(); ?></h3> 
       <span><?php the_terms($post->ID, 'genre', '', ', '); ?></span> 

      </figcaption> 
     </figure> 

     </li> 
     <?php endwhile; ?> 

</ul> 
</div> 

<?php get_footer(); ?> 

回答

0

你只需要改变这一点:

<?php if($image) : ?> 
    <a href="<?php the_permalink(); ?>"><img class="img-responsive" src="<?php echo $image ?>"/></a> 
<?php endif; ?> 

要:

<?php if ($image) : ?> 
    <a href="#"><img class="img-responsive" src="<?php echo $image; ?>"/></a> 
<?php endif; ?> 
+0

为什么保持锚标签呢?从用户体验的角度来看,移除定位标记(和)会更好,以免用户点击图像。毫无疑问,当他们将鼠标悬停在图像上时,他们发现游标发生了变化,他们就会这么做。 – nydame

+0

我同意,但锚标签可能与样式相关,我的答案是解决眼前的问题,而不是增加更多。 –

+0

确实,没有考虑过...... – nydame