title: How to get permalink for every post in this shortcode function
body: <p>I want to get the permalink of the images that shown on the home page, so that when someone clicks on the image redirects to its full post.</p>
  
  <pre><code>add_shortcode( 'zee_recent_works', function( $atts, $content= null ){
    ob_start();
  
    $atts = shortcode_atts(array(
      'slides'        =&gt; 2,
      'title'         =&gt; '',
      'description'   =&gt; ''
      ), $atts);
  
    extract($atts);
  
    $item_per_slide   = 4;
  
    $args             =  array(
      'numberposts'   =&gt;  $item_per_slide*$slides,
      'orderby'       =&gt;  'menu_order',
      'order'         =&gt;  'ASC',
      'post_type'     =&gt;  'zee_portfolio'
      );
  
    $portfolios = get_posts( $args );
  
    $i      = 1;
    $j      = 1;
    $count  = count($portfolios);
  
    if ($count&gt;0) {
      ?&gt;
      &lt;div class="col-md-12"&gt;
        &lt;div id="scroller" class="carousel slide"&gt;
          &lt;div class="carousel-inner"&gt;
            &lt;?php
  
            foreach( $portfolios as $key=&gt;$value ) {
  
              if( (($key+1)%($item_per_slide)==0) || $j== $count) {
                $lastContainer= true;
              } else {
                $lastContainer= false;
              }
  
              if($i==1){
                ?&gt;
                &lt;div class="item &lt;?php echo ($key==0)? 'active': ''; ?&gt;"&gt;
                  &lt;div class="row"&gt;
                    &lt;?php
                  }
                  ?&gt;
                  &lt;div class="col-md-&lt;?php echo round(12/$item_per_slide) ?&gt;"&gt;
                    &lt;div class="portfolio-item"&gt;
                    &lt;div class="item-inner"&gt;
                      &lt;?php 
                      echo get_the_post_thumbnail( $value-&gt;ID, array(400,400), array( 
                        'class' =&gt; "img-responsive", 
                        'alt' =&gt; trim(strip_tags( $value-&gt;post_title )),
                        'title' =&gt; trim(strip_tags( $value-&gt;post_title ))
                        )); 
                        ?&gt;
                        &lt;h5&gt;
                          &lt;?php echo $value-&gt;post_title; ?&gt;
                        &lt;/h5&gt;
                        &lt;div class="overlay"&gt;
                          &lt;?php 
                          $full_img = wp_get_attachment_image_src( get_post_thumbnail_id($value-&gt;ID), 'full');
                          $img_src= $full_img[0];
                          ?&gt;
                          &lt;a class="" title="&lt;?php echo $value-&gt;post_title; ?&gt;" href="&lt;?php the_permalink(); ?&gt;" rel="prettyPhoto"&gt;&lt;/a&gt;   
                        &lt;/div&gt;
                      &lt;/div&gt;&lt;!--.item-inner--&gt;
                      &lt;/div&gt;&lt;!--.portfolio-item--&gt;
                    &lt;/div&gt;    
                    &lt;?php
                    if(($i == $item_per_slide) || $lastContainer) {
                      ?&gt;
                    &lt;/div&gt;&lt;!--/.row--&gt;
                  &lt;/div&gt;&lt;!--/.col-xs--&gt;
                  &lt;?php
                  $i=0;
                }
                $i++;
                $j++;
              }
              ?&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;&lt;!--/.col-md-12--&gt;
        &lt;?php
      }
  
      return ob_get_clean();
    });
  </code></pre>
  
  <p>and the link is there:</p>
  
  <pre><code>&lt;a class="" title="&lt;?php echo $value-&gt;post_title; ?&gt;" href="&lt;?php the_permalink(); ?&gt;" rel="prettyPhoto"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>where the permalink should work but its not working.</p>