Support » Fixing WordPress » Jump link list

  • Resolved the_fear66

    (@the_fear66)


    Hello all,

    I’m new here – haven’t been able to find an answer to this question on the forums, but do go easy on me if it’s been asked before!

    I want to create a list of links at the top of my page that refer to a list of stories further down the page – ie, i want to a create a list of links with jump links to dynamically named anchors further down the page. I want the five most recent stories, and therefore the five most recent links too. Is this possible???

    Thanks!
    Matt

Viewing 2 replies - 1 through 2 (of 2 total)
  • Is this possible???

    Yep.

    <ul><li>Current Posts
    <ul>
    <?php while(have_posts()) : the_post(); ?>
    <li><a href="#post-<?php the_ID(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    </ul>
    </li></ul>

    As long as actual posts on the page have an id attribute associated with them of the format post-123, where 123 = the numeric post ID, it should work fine. Of course you don’t need to place it all in an unordered list; the layout is up to you.

    Thread Starter the_fear66

    (@the_fear66)

    Perfect – works a treat. Much obliged.

    Matt

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Jump link list’ is closed to new replies.