单页链接在wordpress网站中不起作用


Single page links are not working in wordpress website

我的网站遇到了一些奇怪的问题。我已将一些指向我的网站主页的链接添加到另一个页面。像这样的东西

www.fsfsdafsdafdsafsadf/#pro1
www.fsfsdafsdafdsafsadf/#pro2
www.fsfsdafsdafdsafsadf/#pro3
www.fsfsdafsdafdsafsadf/#pro4

现在,当我单击任何链接时,它将div pro1我单击的任何链接。请同时检查该页面的 html

<!--  section  1  image-->
<div id="pro2" name="pro2">
    <div class="inner-image-width">
        <div class="inner-left">
            <div class="titleinner">Unlimited possibilities   </div>
            Some text
        </div>
    <div class="inner-right">
        <img width="500" height="325" src="http://fsfsdafsdafdsafsadf/wp-content/uploads/2016/06/product1.jpg"  alt="product image1">
    </div>
</div>
</div>
<!--  section  1  no image-->
<div id="pro1" name="pro1">
<div class="inner-image-width">
<div ><div class="titleinner">Boost in revenue </div>

一些文本

<!--  section  2  image-->
<div id="p5">
<div class="inner-image-width">
<div class="inner-left">
<div class="titleinner">Improved customer experience  </div>
Some text</div>
<div class="inner-right"><img width="500" height="325" src="http://fsfsdafsdafdsafsadf/wp-content/uploads/2016/07/product4.jpg"  alt="product image1"></div>
</div>
</div>
<!--  section  2  no image-->
<div class="inner-image-width">
<div>
<div class="titleinner">Confidence in security  </div>
Some text</div>
</div>
<!--  section  3 image-->
<div class="inner-image-width">
<div class="inner-left">
<img width="500" height="325" src="http://fsfsdafsdafdsafsadf/wp-content/uploads/2016/07/product3.jpg"  alt="product image1">
</div>
<div class="inner-right"><div class="titleinner">Happier staff   </div>
Some text</div>
</div>
<!--  section  3 no image-->
<div class="inner-image-width">
<div><div class="titleinner">Optimized marketing campaigns  </div>
Some text 
</div>
</div>
<!--  section 4  image-->
<div id="pro3" name="pro3" onlclick="window.location.hash = '#pro3'";>
<div class="inner-image-width">
<div class="inner-left">
<div class="titleinner">Secure payments  </div>
Some text</div>
<div class="inner-right"><img width="500" height="325" src="http://fsfsdafsdafdsafsadf/wp-content/uploads/2016/07/product6.jpg"  alt="product image1"></div>
</div>
</div>
<!--  section  4  no image-->
<div id="pro4" name="pro4">
<div class="inner-image-width">
<div><div class="titleinner">Fun entertainment   </div>
Some text</div>
</div>
</div>
<!--  section  5  image-->
<div id="pro6" name="pro6">
<div class="inner-image-width">
<div class="inner-left">
<img width="500" height="325" src="http://fsfsdafsdafdsafsadf/wp-content/uploads/2016/07/product5.jpg"  alt="product image1">
</div>
<div class="inner-right"><div class="titleinner">Reduced operating costs    </div>
Some text</div>
</div>
</div>
<!--  section  5  no image-->
<div class="inner-image-width">
<div>
<div class="titleinner">Immediate improvements </div>
Some text</div>
</div>
<!--  section 6  image-->
<div class="inner-image-width">
<div class="inner-left">
<div class="titleinner">Increased brand loyalty   </div>
Some text</div>
<div class="inner-right"><img width="500" height="325" src="http://fsfsdafsdafdsafsadf/wp-content/uploads/2016/07/product2.jpg"  alt="product image1"></div>
</div>

<!--  section  6 no image-->
<div class="inner-image-width">
<div><div class="titleinner">Minimal risk  </div>
Some text</div>
</div>
<div style="font-size:24px;"><a href="http://fsfsdafsdafdsafsadf/contact/" target="_blank">Contact us</a> Some text</div>

我尝试了堆栈溢出的所有解决方案,但没有任何效果。任何人都可以帮我这个吗

你只需要使用这个:

<a href="#pro1">Pro 1</a>

因为您在 URL 中使用书签 (#hushtag)。

查看 HTML 链接 - 创建书签

HTML书签用于允许读者跳转到特定部分 一个网页。

如果您的网站页面很长,书签是实用的。

若要创建书签,

必须先创建书签,然后添加 链接到它。

单击链接时,页面将滚动到位置 书签。

在您的情况下,

www.fsfsdafsdafdsafsadf/#pro1 -> click this link will jump to div #pro1
www.fsfsdafsdafdsafsadf/#pro2 -> click this link will jump to div #pro2
www.fsfsdafsdafdsafsadf/#pro3 -> click this link will jump to div #pro3
www.fsfsdafsdafdsafsadf/#pro4 -> click this link will jump to div #pro4

基本上,您的URL书签(#hushtag)工作正常。

如果你想链接到另一个页面,只需避免使用主题标签,也许是这样的:

www.fsfsdafsdafdsafsadf/pro1.php -> 单击此按钮将链接到"Pro1.php"

喜欢这个:

<a href="http://www.fsfsdafsdafdsafsadf/pro1.php">link text</a>
<a href="pro1.php">link text</a>