title: Wordpress tag auto close
body: <p>Wordpress corrects the html markup in posts and also in template specific files.
  I'm working on a template and what I'm trying to achieve is wrap a div in <code>&lt;a href"#"&gt;&lt;/a&gt;</code> tag.</p>
  
  <p>Before the foreach loop there is  placed, then some more php and html markup and right before the foreach loop ends I paste in the ending tag .
  What wordpress doeas it automatically adds the ending tag right after a href string tag, removes the correctly placed ending tag making the link empty.</p>
  
  <p>He're is what I type:</p>
  
  <pre><code>    &lt;li &lt;?php if (get_option('square_portfolio_filter') != "true") { ?&gt; data-id="id-&lt;?php echo $count; ?&gt;" data-type="&lt;?php foreach ($terms as $term) { echo strtolower(preg_replace('/\s+/', '-', $term-&gt;name)). ' '; } ?&gt;" &lt;?php ; } ?&gt;&gt;
  &lt;a href="#"&gt;
      &lt;div class="thumbs-animate"&gt;
          &lt;?php
          if ( has_post_thumbnail() ) {
          the_post_thumbnail(array(255,191), array('title' =&gt; ''.get_the_title().''));
          }
          ?&gt;  
          &lt;div class="details"&gt;
              &lt;h5&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h5&gt;
              &lt;p&gt;&lt;?php content('15'); ?&gt;&lt;/p&gt;
              &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;
              &lt;?php 
              if(get_option('square_view_project_link')!="") {
              echo get_option('square_view_project_link');
              }else {
              _e( 'View Project', 'square_lang' ); 
              }                                       
              ?&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/a&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>And here is what Wordpress ends up saving:</p>
  
  <pre><code>    &lt;li &lt;?php if (get_option('square_portfolio_filter') != "true") { ?&gt; data-id="id-&lt;?php echo $count; ?&gt;" data-type="&lt;?php foreach ($terms as $term) { echo strtolower(preg_replace('/\s+/', '-', $term-&gt;name)). ' '; } ?&gt;" &lt;?php ; } ?&gt;&gt;
  &lt;a href="#"&gt;&lt;/a&gt;
      &lt;div class="thumbs-animate"&gt;
          &lt;?php
          if ( has_post_thumbnail() ) {
          the_post_thumbnail(array(255,191), array('title' =&gt; ''.get_the_title().''));
          }
          ?&gt;  
          &lt;div class="details"&gt;
              &lt;h5&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h5&gt;
              &lt;p&gt;&lt;?php content('15'); ?&gt;&lt;/p&gt;
              &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;
              &lt;?php 
              if(get_option('square_view_project_link')!="") {
              echo get_option('square_view_project_link');
              }else {
              _e( 'View Project', 'square_lang' ); 
              }                                       
              ?&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>I temporarily fixed the issue using some javascript code but its neither good practice nor what I want to have:</p>
  
  <pre><code>onclick="location.href='&lt;?php the_permalink();?&gt;';" style="cursor:pointer;"
  </code></pre>