单击wordpress菜单中的链接,它将重定向到另一页的特定部分

时间:2016-03-15 08:29:53

标签: wordpress menu url-redirection

我想在点击wordpress菜单链接后继续浏览页面的特定部分。在我的wordpress菜单中,我想把链接放在“开始”中。 我尝试添加此http://localadvertisingthatworks.com/test/#my_site,但重定向错误的部分

1.在page.php中:我想在此部分重定向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>

2 个答案:

答案 0 :(得分:1)

只需将<a name="my_site"></a>放在<section>标记之上,就像这样

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

所提供的链接或网址

没有变化

答案 1 :(得分:0)

添加锚标记,你就会很好。

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

<a name="my_site>Anchor</a>

Helpful site