Results 1 to 5 of 5

Help with Twitter and Facebook for individual posts...

This is a discussion on Help with Twitter and Facebook for individual posts... within the Off-Topic & Chit Chat forums, part of the Focus on Members category; I've trawled the internet looking for the answer to this, but haven't been able to come up with anything that ...

  1. #1
    Junior Member
    Real Name
    Will Robinson
    Join Date
    Jan 2008
    Posts
    5
    Liked
    0 times

    Help with Twitter and Facebook for individual posts...

    I've trawled the internet looking for the answer to this, but haven't been able to come up with anything that worked.

    Basically this is the problem.

    I want my users to have the option of sending individual posts to their facebook and twitter. I wanted to have the buttons next to the quick reply and quote buttons, so I entered the following code into my postbit template underneath the part that says <---controls---->

    Code:
    <!-- FB Like-Tweet Button START -->
    <!--VBSEO_VIRTUAL_HTML--><a class="addthis_button_facebook_like"  fb:like:layout="button_count"></a><!--/VBSEO_VIRTUAL_HTML-->
    <a class="addthis_button_tweet"></a>
    <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4d03833d4f0badb3"></script>
    <!-- FB Like-Tweet Button END -->
    This worked well in terms of positioning the buttons where I needed them to be, and it looks exactly how I wanted it to. Unfortunately it does not reference the individual post, only the thread title. I already have facebook and twitter buttons next to the 'post reply' button at the top of the page after making a change to my showthread template, and I need these new buttons to link to the post, not the thread.

    Can anyone help with this? Thanks in advance.

  2. #2
    vBSEO Staff Brian Cummiskey's Avatar
    Real Name
    Brian Cummiskey
    Join Date
    Jul 2009
    Location
    btwn NYC and Boston
    Posts
    12,789
    Liked
    657 times
    Blog Entries
    2
    Note, you cannot use JS within the virtual html tags, unless you specifically mark it up as it would print in a document.write() statement.

    see also:
    Facebook "like" Button for Vbulletin - vBulletin SEO Forums

  3. #3
    Junior Member
    Real Name
    Will Robinson
    Join Date
    Jan 2008
    Posts
    5
    Liked
    0 times
    Sorry Brian, excuse my ignorance but I'm not sure what that means? I got that code from another thread on here, and it appears to be working fine. When you say I cannot use JS within the virtual html tags, can you elaborate please?

    I'm reading through that thread right now. Will this enable people to send individual posts to their facebook, or is it just for the threads?

  4. #4
    vBSEO Staff Brian Cummiskey's Avatar
    Real Name
    Brian Cummiskey
    Join Date
    Jul 2009
    Location
    btwn NYC and Boston
    Posts
    12,789
    Liked
    657 times
    Blog Entries
    2
    Virtual html turns a group of html into a javascript document.write(); statement.
    If anything happens inside of
    <!--VBSEO_VIRTUAL_HTML-->
    to
    <!--/VBSEO_VIRTUAL_HTML-->

    it must be treated as a if it were in a document.write() javascript statement. Any js in there won't function correctly unless marked up correctly.

  5. #5
    Junior Member
    Real Name
    Will Robinson
    Join Date
    Jan 2008
    Posts
    5
    Liked
    0 times
    Ok, I *think* I have this sorted now. I'll post the code in case anyone else is having the same difficulties I was.

    To have twitter and facebook buttons at the top of the page, allowing users to share the THREAD via their twitter and facebook profiles, I have this code in my 'SHOWTHREAD' template:

    Code:
    <iframe src="http://www.facebook.com/plugins/like.php?href=http://www.YOURDOMAIN.com/forums/showthread.php$session[sessionurl]?t=$threadid" amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;font=tahoma&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:280px; height:23px"></iframe>
    </td>
    
    <td><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="yourtwittername" data-url="$vboptions[bburl]/showthread.php?t=$thread[threadid]">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
    </td>
    Then, to have the option for users to share individual posts, I have this code in my POSTBIT template:

    Code:
    <iframe src="http://www.facebook.com/plugins/like.php?href=http://www.YOURDOMAIN.com/forums/showthread.php$session[sessionurl]?p=$post[postid]{vb:raw facebook_liked_url}&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;font=tahoma&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:280px; height:23px"></iframe>
    
    <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-url="http://www.YOURDOMAIN.com/forums/showthread.php?$session[sessionurl]p=$post[postid]&amp;postcount=$post[postcount]" data-via="yourtwittername">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

Similar Threads

  1. Valid XHTML Facebook/Twitter buttons Just for vBSEO Users
    By A.Chakery in forum Member Articles
    Replies: 11
    Last Post: 03-28-2012, 02:46 AM
  2. Facebook / Twitter / Digg Share button scripts
    By A.Chakery in forum Member Articles
    Replies: 11
    Last Post: 01-10-2011, 08:36 AM
  3. Social Buttons (Digg, Facebook, Twitter buttons) in vBulletin 4 CMS?
    By profanitytalker in forum Pre-Sales Questions
    Replies: 8
    Last Post: 11-02-2010, 12:39 AM
  4. Dig, Facebook, Furl, Etc in posts clickable
    By pcam in forum Off-Topic & Chit Chat
    Replies: 4
    Last Post: 12-03-2009, 12:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •