WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Remove link from title?

[Resolved] Remove link from title?

  • slamdunksy21
    Member

    @slamdunksy21

    I want to remove the link from the Title of each post. For example, I want to strip any links from the title, so when I put a link to espn.com in the title, it becomes a hyper link to espn, and not to a detailed view of the post. Any way to do this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Mark (podz)
    Support Maven

    @podz

    Not sure how you would do that, but if you did, how could I then view what you had written ?

    slamdunksy21
    Member

    @slamdunksy21

    My main purpose it to show the article (on another site such as ESPN), and have a brief description below it. Here is an example of a site I’ve seen: http://cuppanews.com Thats exactly how I want it to work where the title links to a completely different site away from my blog. I still want to allow comments and users to read/post comments, but I want the title to link away from the site.

    Since the main question to ask is how do you go about providing the external link, a couple ways to do this are:

    1. Use the excerpt field to insert your link in the post, and replace the_permalink() template tag in your title link with the_excerpt_rss(). Using the_excerpt() would place it in a paragraph tag, whereas the_excerpt_rss() will display it raw.

    The problem with this is it’s a hack, and can cause issues elsewhere a post excerpt may be used, such as syndication feeds or archives.

    2. Insert the external link as a custom field, and display the custom field value in place of the_permalink(). You could use a plugin such as Get Custom Field Values to grab the url, or a bit of code like this (assuming the key is ‘url’):

    <?php if(get_post_custom_values('url')) {
    foreach(get_post_custom_values('url') as $link) {
    }
    } ?>

    Then use this as the_permalink() replacement:

    <?php echo $link; ?>

    slamdunksy21
    Member

    @slamdunksy21

    Thank You!

    how could I have it use normal link to article/post on my page if there is no key defined as url?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Remove link from title?’ is closed to new replies.