Reputation: 3
I'm using wordpress for my website.
I entered the href links on the widgets footer but its not working properly only at the homepage.
Can you help me with my website?
The link at the footer section "services" is not working it is like duplicates the url and it will not refresh or go to the link I entered.
In homepage, the link is working but the other footer page doesn't work. [Here is the link][1].
On different sections the links set have different URLs.
For example the Custom Apparel one when accessed from the home page has - https://opti-advertising.com/offer/#custom link, while if accessed from Contact page it redirects to https://opti-advertising.com/contact/www.opti-advertising.com/offer/?page_id=20#custom.
CODE:
<ul style="line-height: 32px;">
<li><i style="color: #ff0084;" class="icon-layout"></i> <a href="opti-advertising.com/offer/?page_id=20#online_ads">Online Advertising Services</a></li>
<li><i style="color: #ff0084;" class="icon-layout"></i> <a href="www.opti-advertising.com/offer/?page_id=20#printing">Digital & Offset Printing Services</a></li>
<li><i style="color: #ff0084;" class="icon-layout"></i>
<a href="www.opti-advertising.com/offer/?page_id=20#custom">Custom Apparel</a></li>
<li><i style="color: #ff0084;" class="icon-layout"></i>
<a href="www.opti-advertising.com/offer/?page_id=20#traditional">Traditional Advertising Services</a>
</li>
<li><i style="color: #ff0084;" class="icon-layout"></i>
<a href="www.opti-advertising.com/offer/?page_id=20#marketing">Marketing Giveaways</a>
</li>
</ul>
Upvotes: 0
Views: 68
Reputation: 807
You are just hardcoding the links in your footer, e.g. placing links to the footer like this:
<a href="www.opti-advertising.com/offer/?page_id=20#printing">Link</a>
When you access this link from homepage, CMS serves it from the root of your site, and you get the right address:
www.opti-advertising.com/offer/?page_id=20#printing
But if you click this link from any secondary page, you will get the address like this:
www.opti-advertising.com/page/www.opti-advertising.com/offer/?page_id=20#printing
because CMS serves the link from current page, which has path of
www.opti-advertising.com/page/
To solve this, you should at least remove domain name from the url and prepend a slash to it:
<a href="/offer/?page_id=20#printing">Link</a>
But the best approach – is to do things right – generate links dynamically. Wordpress gives you some snippets, for example
site_url();
With this you can do things like:
<a href="<?php site_url('/offer/?page_id=20#printing', https); ?>">Link</a>
which will on any page output this:
https://www.opti-advertising.com/offer/?page_id=20#printing
Upvotes: 1