WordPress.org

Ready to get started?Download WordPress

Forums

Tweet This
manually input function anywhere in theme files (8 posts)

  1. mjoanisse
    Member
    Posted 3 years ago #

    Hi Richard,
    is there any way to integrate some template-tag into our theme template files?
    -

    something similar to '<?php tweet_this(); ?>' - that would output the button where specified?

    Thanks,
    Michel

    http://wordpress.org/extend/plugins/tweet-this/

  2. richardxthripp
    Member
    Plugin Author

    Posted 3 years ago #

    Try <?php tweet_this_manual(); ?> which displays the Tweet This link and all the enabled extended services in a p tag in a div just like automatic insertion. If you see the Tweet This block twice, add <?php remove_filter('the_content', 'insert_tweet_this'); ?> to the top of the theme file. You don't have to edit the Tweet This options and your specified options will continue to affect the Tweet This links.

    If you don't want the p tag or div, you can use <?php echo str_replace(array('<div class="tweetthis" style="text-align:left;"><p>', '</p></div>'), array('', ''), get_tweet_this_manual()); ?> or edit the TT_PREFIX and TT_SUFFIX constants defined in tt-config-sample.php file and rename it tt-config.php. Make sure to not use WordPress automatic plugin update afterward to avoid overwriting the file.

    You can also use <?php tweet_this($service); ?> to display the icon and link for only one service, i.e. <?php tweet_this('twitter'); ?>, <?php tweet_this('facebook'); ?>, <?php tweet_this('myspace'); ?>, etc. If you use these functions, you should disable auto-insertion for Twitter and each extended services in the options to avoid duplicate links. tweet_this(); accepts the parameters $service, $tweet_text, $link_text, $title_text, $icon_file, $a_class, $img_class, $img_alt in that order, but all of them are optional.

    There is more information in the FAQ and source code. Use Ctrl + F as both are very lengthy...

  3. mjoanisse
    Member
    Posted 3 years ago #

    Hi Richard, thanks for the reply. That all looks great, I will give it a shot this and get back to you -

    Regards,
    Michel

  4. richardxthripp
    Member
    Plugin Author

    Posted 3 years ago #

    Alright, good luck!

  5. mjoanisse
    Member
    Posted 3 years ago #

    Hi again, everything worked like a charm, exactly what i was looking for. I really appreciate you're in depth help and support.
    -

    Another question, regarding the facebook service, when i click on link, it takes me to a page and requests i input a page i'd like to share, shouldn't this be auto-populated? Is this do-able with you're plugin?

    Cheers!
    Michel

  6. mjoanisse
    Member
    Posted 3 years ago #

    I've also just experienced another issue.
    -

    I'm using custom permalinks, /%category%/%postname%/

    When i 'twitter this', the auto populated message, outputs the post title and web address but is missing the page's id.

    JP’s first all Original http://localhost:8888/?p=

    Regards,
    Michel

  7. richardxthripp
    Member
    Plugin Author

    Posted 3 years ago #

    I haven't actually tested Tweet This with anything but /%year%/%monthnum%/%postname%/, so maybe /%category%/%postname%/ makes the post ID harder to access? I will make a note of this.

    As for the Facebook problem, the description will be auto-populated if your website is publicly accessible. Since you are running on localhost, it is not, so Facebook has nothing to work with.

  8. richardxthripp
    Member
    Plugin Author

    Posted 3 years ago #

    I have tested /%category%/%postname%/ with local URLs and it worked fine in Tweet This 1.8 on WP 3.0.1 running PHP 5.2.14. Perhaps it will not happen when you are running in a production (online) environment?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic