Forums

Post loads differently when anchor is used (16 posts)

  1. wideblue
    Member
    Posted 10 months ago #

    Hi,

    My client's posts load differently depending on which url is used. It comes down to with anchor(not working correctly) and without anchor(working correctly).

    The permalinks are setup like so: /%category%/%postname%/

    Live links as example:

    Working

    not working

    The difference is subtle, but if you look at the top you can see that the banner is not loading correctly on the anchor page.

    I am at a loss as to why it's not working. I've tried changing the permalinks to /%postname%/ . I've also tried removing the "/" before the "#" as well as changing the anchor on the page from to to no avail.

    If anyone has some expertise in this area it would be greatly appreciated.

  2. Marventus
    Member
    Posted 10 months ago #

    Hi wideblue,

    The WP default anchor for comments is not #comment_anchor, but #respond.
    In order to display a link to a post's comments you should use:
    <?php comments_link(); ?>

    Cheers!

  3. wplb
    Member
    Posted 9 months ago #

    I am having a similar problem, but it's when click to another page. My client wants to link from one page (http://janefaulkner.net/, the link on the bottom "how to engage Jane") to a specific anchor on another page. When you transfer to the other page(http://janefaulkner.net/services/#engage) the top is missing, what would be the correct way to code the welcome page link?

    Thanks so much!

  4. Marventus
    Member
    Posted 9 months ago #

    Hi,

    I just took a look at your code. For your anchors, instead of:
    <h2><a name="engage"></a>How to Engage Jane</h2>
    Try:
    <h2><a name="engage">How to Engage Jane</a></h2>
    The link remains the same:
    <a href="http://janefaulkner.net/services/#engage">

    Good luck.

  5. wplb
    Member
    Posted 9 months ago #

    Marventus thanks for the help.

    The problem is not the anchor its self. I actually do not want the link to remain the same, I want the link to look more like this: http://janefaulkner.net/services/. Instead when you click on the anchor there is no longer a top/navbar to the page. Not sure what I am doing wrong...

    Hope that helps clear up confusion.

    Thanks!

  6. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    <h2><a name="engage">How to Engage Jane</a></h2>

    name is deprecated for anchors, isn't it? That should be <h2 id="engage">How to Engage Jane</h2>.

  7. Marventus
    Member
    Posted 9 months ago #

    Yep, you are right, Esmi. Can't believe I missed that.
    Wplb, try Esmi's solution: it should do the trick.
    Cheers!

  8. wplb
    Member
    Posted 9 months ago #

    Esmi I appreciate the help!
    I changed it to id (TinyMCE buttons created the anchor using name) and it still has not changed the outcome of the link, when you click on "Engage Jane" the top of the page/navbar is still missing.

    Any other ideas... thanks!

  9. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    I didn't think it would but it does help to get the markup right first. :-) My guess is that, by using an anchor, you're by-passing some functionality (possibly conditional) within the theme's header.php file or high up within the single.php template file. as a result, the final page is missing at least one opening wrapper<div> - possibly more than one.

    Sorry but I haven't had the time to go through the two example pages at any great length to define exactly which divs are being missed but it's definitely theme-specific and related to the generation of the wrapper for the pages.

  10. Marventus
    Member
    Posted 9 months ago #

    Hi again,

    Esmi's intuition is correct: I just installed and activated a fresh copy of the theme you used to develop your site (Thematic) and anchors work just fine, which is indicative that something must have broken at the header level while you were modifying the theme.
    Try comparing your header.php file against the original theme's one to try to identify where the issue lies.

    Edit: you can see a working version here.

  11. Marventus
    Member
    Posted 9 months ago #

    Hi,

    Were you able to solve your anchor issue?
    If so, could you please mark this thread as resolved?

    Thanks!

  12. wideblue
    Member
    Posted 9 months ago #

    Hi Marventus,

    Many thanks for your help so far. It's still not resolved. It looks like a URL issue.

    http://www.thiis.co.za/fiction/the-craftsmans-manual/

    or

    http://www.thiis.co.za/fiction/the-craftsmans-manual/#comments_anchor

    the page loads identically(they are bit for bit the same page), but the one with the anchor tag does not load properly in the browser. It's uncanny.

  13. Marventus
    Member
    Posted 9 months ago #

    Yeah, it is very unusual indeed. Are you using the same original theme as wplb (Thematic)?
    I tried to replicate the issue by installing a fresh copy of that theme on my test blawg and anchors worked as they should.
    Here's what I suggest:
    1. Create an exact duplicate of the theme you are using, but change its folder name (for instance, to anchor-test);
    2. Open your duplicated theme's style.css file, and change the theme info that is commented out (i.e., between /* and */).
    3. Upload the duplicated theme into your wp-content/themes folder, and activate it.
    4. See if the anchors work with the duplicated theme.

    If they do, it means you must have broken smth when customizing the theme. If they don't, it could mean there is smth wrong with the theme.
    A good way of identifying what that might be, is to compare the anchor post's source code (Ctrl+U) with the anchor-free's one to see if there are any differences in the html output.

    That's all I can think of for the moment.

  14. wideblue
    Member
    Posted 9 months ago #

    Thanks Marventus,

    A good way of identifying what that might be, is to compare the anchor post's source code (Ctrl+U) with the anchor-free's one to see if there are any differences in the html output.

    As I mentioned:

    the page loads identically(they are bit for bit the same page)

    Which I got to by using ctrl-u.

    I customized a theme to get it to the point where it's at now. It's working well enough - but you right it could be some kind of theme related issue, but I still can't see how they would load differently being identical pages.(except for the URL - the only part that's different that the browser sees). Could be a web standard that I'm violating?

  15. Marventus
    Member
    Posted 9 months ago #

    You could try fixing your HTML validation issues, see if they are causing the anchor problem.
    According the the W3C validator, there are 23 in that particular page. Here is the link to the results.

  16. Marventus
    Member
    Posted 7 months ago #

    Hi,

    Were you able to figure this out? If so, could you please mark this topic as resolved?

    Thanks!

Reply

You must log in to post.

About this Topic

Tags