title: How to include a custom string in a Wordpress permalink?
body: <p>I am a bit confused about how WordPress's permalink works, especially beyond Wordpress's own usage. My permalinks are like:</p>
  
  <pre><code>%post_id%-%post_name%
  </code></pre>
  
  <p>But in <code>single.php</code> I want to put another link to page itself but with different query string. When it is clicked the permalink structure may look  like:</p>
  
  <pre><code>%mystring%-%post_id%-%post_name%
  </code></pre>
  
  <p>I want to get the value from <code>$_GET['action']</code>, so: </p>
  
  <pre><code>$_GET['action'] = %mystring%
  </code></pre>
  
  <p>my plan is to interpret it like:</p>
  
  <pre><code>if('xx' == $_GET['action']){
     //do xx stuff
  } else if ('yy'==$_GET['action']){
     //do yy stuff
  } else {
     //show the single post as a single.php always shows
  }
  </code></pre>
  
  <p>that means, I want to parse the <code>$_GET['action']</code> optionally. If I do not parse it even if it is available in query string, I want the page to be rendered correctly.</p>
  
  <p>So to get this done, where should I actually work? Also how do I form the link for <code>&lt;a&gt;</code> tag? Usually we make link this way:</p>
  
  <pre><code>&lt;a href="'.the_permalink().'"&gt;TEXT&lt;/a&gt;
  </code></pre>
  
  <p>but you already know, I need to add some text before the original permalink of post.</p>
  
  <p>Thanks in advance. </p>