title: Check if URL contains certain word php wordpress
body: <p>I want to show only posts that contain a certain word in the url. I got this, but it isn't working. I want all the posts that contain blog or news in the url.</p>
  
  <pre><code>    &lt;?php 
  $url = $_SERVER["REQUEST_URI"];
  
  $isItBlog = strpos($url, 'scotch');
  $isItNews = strpos($url, 'soda');
  
  if ($isItBlog!==false)
  { 
  ?&gt;
  &lt;h1 class="cat"&gt;Worked with - &lt;/h1&gt;
                 &lt;h1 class="entry-title"&gt;&lt;a title="&lt;?php printf( esc_attr__( 'Permalink to %s', 'compass' ), the_title_attribute( 'echo=0' ) ); ?&gt;" href="&lt;?php the_permalink(); ?&gt;" rel="bookmark"&gt; &lt;?php the_title(); ?&gt;
                 &lt;/a&gt;&lt;/h1&gt;
                 &lt;div class="clearfix"&gt;&lt;/div&gt;
          &lt;?php the_post_thumbnail( 'category-thumb'); ?&gt;
                 &lt;div class="entry-content"&gt;&lt;?php the_content(); ?&gt;&lt;/div&gt;
  
  
  &lt;?php
  }
  if ($isItNews!==false)
  {
  ?&gt;
       &lt;h1 class="entry-title"&gt;&lt;a title="&lt;?php printf( esc_attr__( 'Permalink to %s', 'compass' ), the_title_attribute( 'echo=0' ) ); ?&gt;" href="&lt;?php the_permalink(); ?&gt;" rel="bookmark"&gt; &lt;?php the_title(); ?&gt;
                 &lt;/a&gt;&lt;/h1&gt;
                 &lt;div class="clearfix"&gt;&lt;/div&gt;
          &lt;?php the_post_thumbnail( 'category-thumb'); ?&gt;
                 &lt;div class="entry-content"&gt;&lt;?php the_content(); ?&gt;&lt;/div&gt;
  
  &lt;?php } ?&gt;
         &lt;/article&gt;
  </code></pre>
  
  <p>Regards</p>