Support » Plugins » Post Title Link to Source, not Single – & – Comments Link to Single

  • hi

    I need some help.

    I would like to have the post title link to the source, like a news article. And at the same time offer a comments popup (next to the post title) link to the single.php page which would allow commenting.

    I’ve tried to accomplish this but have failed.

    This is something this site has achieved http://www.drudge.com/ – but I can’t figure it out

    Thanks for any help

Viewing 2 replies - 1 through 2 (of 2 total)
  • The easiest solution would be to use a custom field to store the external link and then modify you theme to recognize the field. You will need to add the following code to index.php and, if present, category.php and archive.php.

    <?php
    	$id = intval( $post->ID );
    	$external_link = get_post_meta( $id, 'external_link', true );
    	$href = ( $external_link ) ? $external_link : get_permalink( $id );
    	print '<h2 id="post-' . $id . '"><a href="' . $href . '" rel="bookmark">' . the_title( '','', false ) . '</a></h2>';
    	comments_popup_link( 'Add a Comment', '1 Comment', '% Comments' );
    ?>
    Thread Starter justinmyoung

    (@justinmyoung)

    Just wanted to say thanks very much for that bit of code – works great!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post Title Link to Source, not Single – & – Comments Link to Single’ is closed to new replies.