title: Linking to specific ID on another Wordpress page?
body: <p>I have a header.php, that appears in every single page on my blog, with a navbar that looks like this:</p>
  
  <pre><code>&lt;nav&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="&lt;?php echo get_permalink(4); ?&gt;"&gt;Logistics&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="&lt;?php echo get_permalink(5); ?&gt;#contact"&gt;Contact&lt;/a&gt;&lt;/li&gt;      
    &lt;/ul&gt;
  &lt;/nav&gt;
  </code></pre>
  
  <p>But when I click the anchor tag linking to #contact, which is located in page with id 5, as you can see by the php code, nothing happens. I tried using a slash (/#contact) but I keep getting the same behavior. Isn't this the correct way of linking to a specific id on another page?</p>
  
  <p>EDIT: I also have some smooth scrolling code (below) which I think may be related to my issue.</p>
  
  <pre><code>&lt;script&gt;
    $( document ).ready( function () {
  
       // Add smooth scrolling to all links
       $( "a" ).on( 'click', function ( event ) {
  
           // Make sure this.hash has a value before overriding default behavior
           if ( this.hash !== "" ) {
  
               // Prevent default anchor click behavior
               event.preventDefault();
  
               // Store hash
               var hash = this.hash;
  
               // Using jQuery's animate() method to add smooth page scroll
               // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
               $( 'html, body' ).animate( {
                  scrollTop: $( hash ).offset().top
               }, 800, function () {
  
                    // Add hash (#) to URL when done scrolling (default click behavior)
                    window.location.hash = hash;
                } );
           } // End if
         } );
        } );
  &lt;/script&gt;
  </code></pre>
  
  <p>Thanks!</p>