Support » Fixing WordPress » URL link in the loop

  • I’m trying to achieve something not to unlike to how the digg link system works. The title is links to the original page/site and then there is a short excerpt.

    I know how to add all of this in it’s just I don’t know how to create a field that can be used as the url field and get it in the loop. Any help?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Something like:
    <a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>">

    I think you misunderstood what I was aiming for (due to the lack of detail in my description).

    I was looking to do something along the lines of this ( http://wordpress.org/support/topic/85287?replies=6 ) but I’m a bit clueless as to where to start as I didn’t really understand the custom fields documentation.

    Anyway, I’ll give it a shot and may try the plug in.

    Here’s one solution to this:

    1. Add a custom field to your posts with a key of ‘link’ and a value the url of the ‘source’ you want post titles to link to.

    2. Rewriting Handy’s code:

    <?php
    $link = get_post_custom_values('link');
    $title_url = ($link) ? $link[0] : get_permalink();
    ?>
    <a href="<?php echo $title_url; ?>" title="Link to <?php the_title(); ?>"><?php the_title(); ?></a>

    Awesome. Works a charm. Cheers. (Again!)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘URL link in the loop’ is closed to new replies.