WordPress.org

Ready to get started?Download WordPress

Forums

Adding Twitter Functionality via Custom Field (1 post)

  1. jbocook
    Member
    Posted 1 year ago #

    When a visitor views a post, they see a tweet button. Currently the a herf of the button is set to
    <a href="http://twitter.com/home?status=<?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 http://www.link.com/title"

    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 = 'http://twitter.com/home?status=<?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.

Topic Closed

This topic has been closed to new replies.

About this Topic