[resolved] Jump Links in the Loop (4 posts)

  1. hugsformonsters
    Posted 6 years ago #

    Hey all.

    I am currently developing a theme that has a very large header (http://wpdev.hugsformonsters.com).

    I got the idea to include a jump link in my index.php loop to take users directly to the content of the post they click on:

    <a href="<?php the_permalink() ?>/<strong>#header</strong>" rel="bookmark" title="<?php the_title_attribute(); ?>">

    I included this html on the single.php page:

    	<a <strong>name="header"</strong> rel="bookmark" title="<?php the_title_attribute(); ?>">
    		<?php the_title(); ?>

    The link on index.php always takes you to the correct post without incident, but it does not take you to the correct point on the page. I did some searching and was unable to find a similar case of this.

    Is there anything in WordPress that prevents the use of jump links in this manner?

    Thank you!

  2. hugsformonsters
    Posted 6 years ago #

    Uhh, ignore the [strong][/strong] in there. I was formatting the post here and stupidly forgot that adding bold to something in a pre tag would just show the code to make something bold ;P

  3. Robert Chapin
    Posted 6 years ago #

    In the XHTML doctype definition, the "id" and "name" attributes are synonymous. Since you already have a DIV element with "header" as the id, and it is required to be unique, the browser may choose to ignore the name of your A element.

    "header2" would work better, for example.

  4. hugsformonsters
    Posted 6 years ago #

    Oh snips! I didn't realize that about id and name.

    Thanks dude!

Topic Closed

This topic has been closed to new replies.

About this Topic