Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jent

macrumors 6502a
Original poster
Mar 31, 2010
893
568
At my nonprofit our web developers just made a few of our pages editable in WordPress so that we can edit them ourselves without needing to go through them. I understand a bit of the basics behind HTML, but I can't for the life of me figure out the correct formatting for anchor links.

I'd like to set up a few anchor links for things like "Click here to jump down to section X," but for whatever reason I can't get anchor links to work. Any help is appreciated. Thanks!
 

Dunmail

macrumors regular
Mar 27, 2009
224
4
Skipton, UK
Hmm, I answered this prior to the forums getting hacked and it seems to have gone AWOL :(

Links can be between pages:

Code:
<a href="https://en.wikipedia.org/wiki/Main_Page">Wikipedia</a>

Or to an anchor within the same page:

Code:
<a id="fred" />

<a href="#fred">Go to Fred</a>

For SEO purposes have the link text be something related to where you are linking to rather than a generic "Click here for ..."
 

jent

macrumors 6502a
Original poster
Mar 31, 2010
893
568
I will be back at work later in the week and able to try this out on our site.

For the sake of completeness, I am pasting Dunmail's original reply to help anyone else that may be having HTML anchor issues in WordPress like me.

It's not clear from your post but I think you are asking how you write in-page rather than between page links.

If you want to link to a separate page then you do this:

Code:
<a href="https://en.wikipedia.org/wiki/Main_Page">Wikipedia</a>

To link to another part of the same page you do this:

Code:
<a href="#top-of-page">Back to top</a>

For this to work you also need a named anchor point to jump to:

Code:
<a name="top-of-page"></a>

For SEO purposes it's best to use relevant text in the link. Rather than generic "Click to jump down to X", something like "Help the Homeless" is better as search engines will be able to make the connection between the text and the subject.
 

jent

macrumors 6502a
Original poster
Mar 31, 2010
893
568
I spoke to our web developers who informed us that anchor links wouldn't work because of the nature of the website implementation; instead of the whole website being WordPress, it's just a portion of the site.

Thus, HTML anchors don't work because they are limited to a section of the page instead of being page-wide. It's not what I wanted to hear but it makes sense.
 

Dunmail

macrumors regular
Mar 27, 2009
224
4
Skipton, UK
I spoke to our web developers who informed us that anchor links wouldn't work because of the nature of the website implementation; instead of the whole website being WordPress, it's just a portion of the site.

Thus, HTML anchors don't work because they are limited to a section of the page instead of being page-wide. It's not what I wanted to hear but it makes sense.

That doesn't make sense. Once the page is built up and sent to the browser then one part of the page is able to link to any other part. A URI would be useful.

Are your developers using iframes?
 

jent

macrumors 6502a
Original poster
Mar 31, 2010
893
568
That doesn't make sense. Once the page is built up and sent to the browser then one part of the page is able to link to any other part. A URI would be useful.

Are your developers using iframes?
Yup, the WordPress on each of our website's pages is in an iframe. Is there a way for me to use anchor links in my page and not have the fact that the WordPress is embedded in an iframe prevent users from enjoying these jump links?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.