• Resolved unsomnambulist

    (@unsomnambulist)


    I’m trying to make a Drudge Report/Huffington Post type blog that will have both original content, but also a ton of headline that link to other blogs.

    Perhaps there’s a way to do this by overwriting the permalink field somehow, on demand?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I can no longer find the thread where I provide a manual solution for this, but as I was about to write it out here I realized you can (these days) easily roll it into a plugin. So:

    Override the_permalink()
    Download plugin | View source

    When the plugin is activated it will look for any post with a custom field key of ‘url’ and (hopefully) the url you want to change the permalink *to* as the value.

    It has a few user-configurable variables you should know about:

    $custom_key = The custom field key the plugin looks for. Default is 'url'.

    $only_on_single = If you only want to alter the permalink on individual post (permalink) pages, change this to true (false is the default, which means the plugin will override the_permalink() everywhere on your blog!).

    You can edit the variables either through the Plugin Editor in WordPress, or in a text editor off-line.

    —–
    If you want this in a few specific places on your blog, here’s a manual method… Before where the_permalink() appears in your template(s), add the following:

    <?php
    global $post;
    $url = get_post_meta($post->ID, 'url', true);
    $permalink = ($url) ? $url : get_permalink($post->ID);
    ?>

    Then just change:

    <?php the_permalink(); ?>

    to:

    <?php echo $permalink; ?>

    Thread Starter unsomnambulist

    (@unsomnambulist)

    Thanks! That works great so far!

    good advice. but how do I change only one permalink/catalog link. I have changed the $only_on_single to true. How do I go about finding this one permalink and chnging it so that it points to an external url/www ?
    I want a category link to point to a www site.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can I make titles/permalinks link to an off site URL?’ is closed to new replies.