Support » Fixing WordPress » Adding Twitter Functionality via Custom Field

  • When a visitor views a post, they see a tweet button. Currently the a herf of the button is set to
    <a href="<?php the_title(); ?> via @sometwitterid <?php echo get_permalink(); ?>" target="_blank" class="tweet">

    What I would like to do, is have a custom field setup and the value of that field to populate the output of the a href from above “Title via @sometwitterid

    This way we can change what the a href looks like before we publish the post, to add hashtags or change the title, add another @twitterid.

    I’m looking for the proper way to do this: <?php $tweet = '<?php the_title(); ?> via @sometwitterid <?php echo get_permalink(); ?>

    Then I should be able to set $customfield = $tweet and it should populate in the custom field box in the editor.

    Will this work? What’s the proper way to html/php a link? I read the php docs but haven’t figured it out.

  • The topic ‘Adding Twitter Functionality via Custom Field’ is closed to new replies.