Click on link in wordpress menu and it redirects to specific section of another page

I want to go on specific section of page after click on wordpress menu link.In my wordpress menu I want to put link in “get started”.
I have tried to add this http://localadvertisingthatworks.com/test/#my_site but it redirect in wrong section

1.In page.php:I want to redirect at this section at id=”my_site”

<section class="forecourtsWrapper" id="my_site">
<a href="<?php echo site_url();?>/adnozzles/">
  <div class="container">
    <div class="row" >
      <h2>Exclusive UK license for petrol pump advertising</h2></a>
      <div class="cf" >
        <div class="col-xs-12 col-sm-3 col-md-4"><img src="<?php echo get_template_directory_uri(); ?>/images/forecourts-img1.png"  alt=""/> </div>
        <div class="col-xs-12 col-sm-9 col-md-8">
          <div class="typesFC cf" >
            <ul>
              <li>
                <h3>Supermarket</h3>
                Tesco, Sainsbury’s<br/>
                and Morrisons </li>
              <li>
                <h3>Roadside</h3>
                BP, Esso, Texaco, Murco,<br/>
                Jet and others </li>
              <li>
                <h3>Motorway</h3>
                Moto, Road Chef and<br/>
                Welcome Break </li>
            </ul>
          </div>
          <div class="petrolLogos" id="site_finder" >
            <ul>
              <li><img src="<?php echo get_template_directory_uri(); ?>/images/petrol-logo1.png"  alt=""/></li>
              <li><img src="<?php echo get_template_directory_uri(); ?>/images/petrol-logo2.png"  alt=""/></li>
              <li><img src="<?php echo get_template_directory_uri(); ?>/images/petrol-logo3.png"  alt=""/></li>
              <li><img src="<?php echo get_template_directory_uri(); ?>/images/petrol-logo4.png"  alt=""/></li>
              <li><img src="<?php echo get_template_directory_uri(); ?>/images/petrol-logo5.png"  alt=""/></li>
              <li><img src="<?php echo get_template_directory_uri(); ?>/images/petrol-logo6.png"  alt=""/></li>
              <li><img src="<?php echo get_template_directory_uri(); ?>/images/petrol-logo7.png"  alt=""/></li>
              <li><img src="<?php echo get_template_directory_uri(); ?>/images/petrol-logo8.png"  alt=""/></li>
              <li><img src="<?php echo get_template_directory_uri(); ?>/images/petrol-logo9.png"  alt=""/></li>
              <li><img src="<?php echo get_template_directory_uri(); ?>/images/petrol-logo10.png"  alt=""/></li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

Related posts

2 comments

  1. just put <a name="my_site"></a> above <section> tag like this

    <a name="my_site"></a>
    <section class="forecourtsWrapper" id="my_site">
    

    No change in the link provided or in URL

  2. Add anchor tags and you’ll be good.

    <a href="http://localadvertisingthatworks.com/test#my_site">Link</a>
    
    <a name="my_site>Anchor</a>
    

    Helpful site

Comments are closed.