WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Page Jump / Same Page Anchor Link / Top of Page

[Resolved] Page Jump / Same Page Anchor Link / Top of Page

  • hsatterwhite
    Member

    @hsatterwhite

    I recently added a page jump to the top of the page in a template file, but when I load my WordPress install it renders the the page jump anchor link as http://www.domain.com/#top rather than #top

    This results in a wrong link that does not work in Safari and Google Chrome. Is there any to keep WordPress from automatically adding the domain + the forward slash for page jumps coded in to template files?

    Thanks!

Viewing 15 replies - 1 through 15 (of 28 total)
  • I tried to duplicate the problem in IE8 and Foxfire by putting <p><a href='#test'>Jump to test</a></p> in single.php. However, that did not fail for me. Viewing the page source showed exactly that, with no added code.

    Do you have a plugin that might be affecting anchors?

    hsatterwhite
    Member

    @hsatterwhite

    I have no other plugins that could be doing this. The only other two plugins that are active are NextGen Gallery and CformsII.

    This is really odd though. If it helps I’m trying to code it in to page.php

    When does the change occur? Is it when you save the modified page.php, or when the page is sent to the browser?

    Can you paste the modified page.php to WordPress pastebin so I can have a look?

    hsatterwhite
    Member

    @hsatterwhite

    The change occurs when it is rendered in the browser. Browsers I’ve tried it in include the latest stable releases of Firefox, Safari, and Chrome.
    Paste Bin: Page Jump
    vtxyzzy, thanks for your help thus far!

    Does it make a difference if you use single quotes like this:

    <a href-'#top'>

    I do that out of habit, but it may make a difference.

    hsatterwhite
    Member

    @hsatterwhite

    Unfortunately it does not make a difference.

    Well, I am out of ideas on this one. If you get it solved, please post the solution back here for future reference.

    hsatterwhite
    Member

    @hsatterwhite

    Well do and thanks again!

    esmi
    Forum Moderator

    @esmi

    Can you post a link to a live page that uses this template so we can see the generated link? Have you tried deactivating both of your active plugins?

    Try using ..
    <a href="<?php the_permalink(); ?>#top">Top</a>

    So you end up with a complete link of the current page/post plus the anchor…

    hsatterwhite
    Member

    @hsatterwhite

    Hi esmi,
    Live page
    It’s a horizontally scrolling website, so if you scroll to the right some you’ll see the back button/arrow appear, which is what I’m having a problem with.

    I have not deactivated either plugin, however I was having this problem before installing those plugins.

    esmi
    Forum Moderator

    @esmi

    Using just #top should work, though – unless there’s some funky rewriting going on. Now there’s a thought…

    @hsatterwhite: can you try resetting your custom permalinks back to the default (ugly) setting and deleting the .htaccess file in the root WP folder?

    The anchor works for me on your page…

    Did you fix it?

    hsatterwhite
    Member

    @hsatterwhite

    @esmi Ok, I’ve set the permalinks back to their default and removed the .htaccess file, but we’re still seeing the same thing.

    hsatterwhite
    Member

    @hsatterwhite

    @t31os_ Are you trying it in Firefox? It’s work for me in Firefox just fine, but it’s unresponsive in Safari/Chrome because WordPress is apending http://www.twoplusonedesign.com/ to #top — Thanks for trying it out though!

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘[Resolved] Page Jump / Same Page Anchor Link / Top of Page’ is closed to new replies.