title: generate shortcode for php and html code
body: <p>I want to generate shortcode for the following code. I am not sure where to place shortcode function. I tried below code but the shortcode is not working.
  I have added function <code>function lorem_function() {}</code>. I want the shortcode lorem to work so that output of the below can be display anywhere in the wordpress page. </p>
  
  <pre><code>&lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;style type="text/css"&gt;
      .offer-title{
          font-size: 20px;
          font-weight: bold;
      }
      .offer-col{
          height: 600px;
      }
      .offer-row{
          margin: 30px 0;
      }
      .offer-info{
          font-size: 15px;
      }
  &lt;/style&gt;
  &lt;?php 
  /*
  Template Name: Blank - No Header, no Footer
  */
  if ( !defined('ABSPATH') ){ die(); }
  /*
  * A blank Template that allows you to build landing pages, coming soon pages etc
  */  
  global $avia_config;
  get_header();
  ?&gt;
  &lt;?php
  function lorem_function() {
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, "http://api.bstcm.no/customer/-8/offers");
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
      curl_setopt($ch, CURLOPT_HEADER, FALSE);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array(
          $username = 'atrium',
          $password = '3HnzkG2p',
          curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password)
      ));
      $response = curl_exec($ch);
      curl_close($ch);
      $details = json_decode($response, TRUE);
      /*echo"&lt;pre&gt;";
  print_r($details);
  echo"&lt;/pre&gt;";*/
      $max_count = count($details[collections]);
  ?&gt;
  &lt;div class='container_wrap container_wrap_first main_color 
  &lt;?php avia_layout_class( 'main' ); ?&gt;'&gt;
      &lt;div class='container'&gt;
          &lt;div class='offer-row col-sm-12'&gt;
              &lt;?php
      $flag=0;
      for($i=0;$i&lt;$max_count;$i++)
      {
          $count[$i] = count($details[collections][$i][offers])."....";
          for($j=0;$j&lt;$count[$i];$j++)
          {
              $flag++;
              if($flag%2==0)
              { 
                  if($flag%4==0)
                  {
              ?&gt;
              &lt;div class='offer-col col-sm-3'&gt;
                  &lt;img src="&lt;?php echo $details[collections][0][offers][$j][offerFile][originalUrl]; ?&gt;"&gt;&lt;br/&gt;
                  &lt;span class="offer-title"&gt;
                      &lt;?php echo $details[collections][0][offers][$j][offerName];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Giltighetstid: 
                      &lt;?php echo $details[collections][0][offers][$j][startDatetime];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;T.o.m.: 
                      &lt;?php echo $details[collections][0][offers][$j][endDatetime];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Begränsat antal köp per kund: 
                      &lt;?php echo $details[collections][0][offers][$j][limitedUse];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Antal: 
                      &lt;?php echo $details[collections][0][offers][$j][limitedTo];?&gt; &lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
              &lt;/div&gt;
              &lt;?php 
                  }
                  else
                  {
              ?&gt;
              &lt;div class='offer-col col-sm-3'&gt;
                  &lt;img src="&lt;?php echo $details[collections][0][offers][$j][offerFile][originalUrl]; ?&gt;"&gt;&lt;br/&gt;
                  &lt;span class="offer-title"&gt;
                      &lt;?php echo $details[collections][0][offers][$j][offerName];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Giltighetstid: 
                      &lt;?php echo $details[collections][0][offers][$j][startDatetime];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;T.o.m.: 
                      &lt;?php echo $details[collections][0][offers][$j][endDatetime];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Begränsat antal köp per kund: 
                      &lt;?php echo $details[collections][0][offers][$j][limitedUse];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Antal: 
                      &lt;?php echo $details[collections][0][offers][$j][limitedTo];?&gt; &lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
              &lt;/div&gt;
              &lt;?php
                  }
              } 
              else
              { 
                  if($flag%3==0)
                  {
              ?&gt;
              &lt;div class='offer-col col-sm-3'&gt;
                  &lt;img src="&lt;?php echo $details[collections][0][offers][$j][offerFile][originalUrl]; ?&gt;"&gt;&lt;br/&gt;
                  &lt;span class="offer-title"&gt;
                      &lt;?php echo $details[collections][0][offers][$j][offerName];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Giltighetstid: 
                      &lt;?php echo $details[collections][0][offers][$j][startDatetime];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;T.o.m.: 
                      &lt;?php echo $details[collections][0][offers][$j][endDatetime];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Begränsat antal köp per kund: 
                      &lt;?php echo $details[collections][0][offers][$j][limitedUse];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Antal: 
                      &lt;?php echo $details[collections][0][offers][$j][limitedTo];?&gt; &lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
              &lt;/div&gt;
              &lt;?php 
                  }
                  else
                  {
              ?&gt;
              &lt;div class='offer-col col-sm-3'&gt;
                  &lt;img src="&lt;?php echo $details[collections][0][offers][$j][offerFile][originalUrl]; ?&gt;"&gt;&lt;br/&gt;
                  &lt;span class="offer-title"&gt;
                      &lt;?php echo $details[collections][0][offers][$j][offerName];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Giltighetstid: 
                      &lt;?php echo $details[collections][0][offers][$j][startDatetime];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;T.o.m.: 
                      &lt;?php echo $details[collections][0][offers][$j][endDatetime];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Begränsat antal köp per kund: 
                      &lt;?php echo $details[collections][0][offers][$j][limitedUse];?&gt;&lt;/span&gt;&lt;br/&gt;
                  &lt;span class="offer-info"&gt;Antal: 
                      &lt;?php echo $details[collections][0][offers][$j][limitedTo];?&gt; &lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
              &lt;/div&gt;
              &lt;?php
                  }
              }
          }
      }
      return $details;
              ?&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;?php get_footer(); 
  }
  add_shortcode('lorem', 'lorem_function');
      ?&gt; 
  </code></pre>