• Resolved derekbeck

    (@derekbeck)


    Though I set button counter and “recommend” instead of “like”, the resulting option is the long standard button with “like” and the big space beside it with “Be the first of your friends to like this.”. Why are the variables not being passed? Do I need to do so manually? Thanks!

    Using this code:

    <?php if (function_exists('sfc_like_button')) echo sfc_like_button();?>

Viewing 15 replies - 1 through 15 (of 15 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Yeah, the old version does that. My bad. You can pass variables to it as an array as well.

    sfc_like_button(array('action'=>'recommend', 'layout'=>'button_count'));

    Thread Starter derekbeck

    (@derekbeck)

    And if you are trying to figure out what I’m doing: I’m trying to put these all in line nicely: facebook button w/ counter, twitter button w/ counter, sharethis button.

    You can see it the included php file at https://www.derekbeck.com/1775/social.php

    Thread Starter derekbeck

    (@derekbeck)

    Awesome, that works… any idea on why the sfc_like causes so much spacing to its right?

    Thread Starter derekbeck

    (@derekbeck)

    that’s the source code at https://www.derekbeck.com/1775/social.php

    but to see it rendered: https://www.derekbeck.com/1775/
    (I keep trying things, so it is bound to change before you read this)

    The spacing around the buttons is really strange… lot’s of excess.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    You can specify the width as well. 'width'=>90 or what have you. There is a minimum width for each layout of the button.

    Thread Starter derekbeck

    (@derekbeck)

    thanks!

    craigtommola

    (@craigtommola)

    Please confirm, if I want to insert the like + counter button in my theme, I would use the following …

    <?php if (function_exists('sfc_like_button')) echo sfc_like_button(array('action'=>'recommend', 'layout'=>'button_count'));?>

    Is that right?

    Thx
    CT

    Thread Starter derekbeck

    (@derekbeck)

    Yeah, that looks right.

    in which file would i post that code craigtommola wrote?

    also, can you provide me with the code for the share button and the twitter “tweet” button?

    (My problem is that the social media buttons are also showing up on my content boxes which make up my side bars, and I don’t want them there. I figured the best solution is to just switch to manual placement of the buttons and only put them under each post. However, I’m a designer not a programmer and I have the knowledge of a fetus when it comes to PHP. I’ve managed to tweak what I need to make custom pages with custom sidebars, but this Facebook and Twitter connect thing is killing me. I can’t figure out where the code goes to just have the buttons show up for posts only and not the content boxes. I’d really appreciate your help if you can. Thanks.)

    Here’s a preview of my site: https://www.lexevan.com (work in progress)

    Thread Starter derekbeck

    (@derekbeck)

    First, for what its worth, the link above that I gave has changed to: https://www.derekbeck.com/1775/social-wp.php

    but it doesn’t matter, as you cannot see the php lines, because they are rendered before you call upon them to view it… Plus, that was a dummy test I used to toy around with this stuff, and is not what I’m using on my site.

    Lexevan:

    if you want to avoid coding, here’s the simplest solution I can think of:

    First: install Simple Facebook Connect and Simple Twitter Connect plugins, activate their bases, then activate SFC-share (or SFC-like) and STC-tweet button. Go to your wordpress theme and settings to set each up, per the instructions on those pages. For each, click the radio button for the option “manually include the button” in your code.

    Next, add and activate the plugin “Allow PHP in posts and pages” by Hit Reach. This will allow you to paste the following code at the end of every post you want it.

    Paste this code in your post (you can next it in HTML tables or what not to get it to orient the way you’d like):

    <?php if (function_exists('stc_tweetbutton')) echo stc_tweetbutton();?>

    and

    <?php if (function_exists('sfc_like_button')) echo sfc_like_button(array('layout'=>'button_count','showfaces'=>'false','width'=>'130','height'=>'25','action'=>'recommend','colorscheme'=>'light','font'=>'lucida+grande'));?>

    These are the options for the above code:

    Defaults:
    ‘id’=>0, // id of the facebook page to like? (not sure), if 0, likes the present page?
    ‘layout’=>’standard’, // standard or button_count
    ‘showfaces’=>’true’, // true or false
    ‘width’=>’450’,
    ‘height’=>’65’,
    ‘action’=>’like’, // like or recommend
    ‘colorscheme’=>’light’, // light or dark
    ‘font’ => ‘lucida+grande’, // arial, lucida+grande, seqoe+ui, tahoma, trebuchet+ms, or verdana

    For a share button instead of a like button:
    <?php if (function_exists('sfc_share_button')) echo sfc_share_button();?>

    I strongly encourage the share button, not the like button, for posts. The like button should not be different for every page. For example: all my like buttons now are setup to like the facebook official page, not the present page on my website. If you have people like individual pages, it merely dilutes your total likes, and you have no good way to track those likes either. As I do on my site ( https://www.derekbeck.com/1775/ ), people can like the site, which is really liking the facebook official page, and they can fb share or tweet after any post. If you must use likes for your posts, I encourage you to use “recommend” instead of like, especially if you are also using a like for the site which is tied to a facebook fan page.

    Full disclosure: I abandoned this approach and ended up hard-coding my tweet and like and share buttons onto my site. It seemed it was the only way to get the buttons placed exactly as I wanted them.

    Lexevan: if you desire to hard-encode, you don’t need php. I wrote the like button using the techniques below and saved it to a php file, and I wrote the twitter and fb share button using the code below and put it into another php file. I then dug into my WP theme and placed a call for each of these php files in the places I wanted them to appear, the former on all pages, the latter only on posts or static pages. Depending on your theme, you may be able to easily get to the place you need to make these calls: “the loop”. But if this is too much an undertaking, you can simply manually type the following code into your posts whenever you desire it. Alternatively, you can put this code into a text widget for a sidebar. The following techniques do not require ANY of the plugins just noted above.

    for the fb share button, paste this code:

    <a name="fb_share" type="button_count" href="https://www.facebook.com/sharer.php">Share</a>
    <script src="https://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

    (note: the share button is 20px high)
    facebook seems to not encourage this button any longer, so finding details on it on their site is hard… but their like buttons are problematic, as noted above

    for the twitter tweet button, paste this code:

    <a href="https://twitter.com/share" class="twitter-share-button" data-text="any prefix text you'd like in the tweet" data-count="horizontal" data-via="a twitter username">Tweet</a>
    <script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>

    (note: the tweet button is 20px high)
    For the twitter button, to find all the variables, see https://twitter.com/about/resources/tweetbutton

    for the facebook like button, paste this code:

    <iframe src="https://www.facebook.com/plugins/like.php?href=YOURWEBSITEORFACEBOOKPAGETOLIKE&layout=standard&show_faces=false&width=450&action=like&font=arial&colorscheme=light&height=30" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:30px;" allowTransparency="true"></iframe>

    For the like button, facebook will generate the button for you, though their wizard is clunky. See https://www.facebook.com/share/

    Finally, as I’ve taken long to explain all of this to you, if you find it useful, please go to my own website and please consider sharing it by fb or twitter to all of your history friends (my site is “1775”, a forthcoming history book), and i would of course welcome it if you like the page as well! ?? My site: https://www.1775thebook.com

    Derek

    Thread Starter derekbeck

    (@derekbeck)

    One more thought: on the like button in the last example, “YOURWEBSITEORFACEBOOKPAGE” has to be set to a URL of your chosing, but you can set it to your facebook page, which I have done, thus making any click on your website a like on your fan page.

    Finally, all punctuation in this URL has to be encoded for URL usage, per these instructions:
    https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters

    So https://derekbeck.com becomes http%3A%2F%2Fderekbeck.com (periods don’t get encoded)

    great post !!!! thanks !

    I wanna set my like button and my share button next to eachother instead of below. How do I do that ?

    Thread Starter derekbeck

    (@derekbeck)

    you simply put them wherever you want, in the code as you like. If you want them next to each other, see how I did them:

    https://www.derekbeck.com/1775/social-sharemenu.php
    (that link is subject to change w/o notice)

    Note the php information listed above in the tutorial does not reveal itself if you go to the above link and look at the source code.

    You can basically put the buttons in a table, a list, whatever. With a list, as I have done in the link above, you can see that you can force the list to go right, instead of down (which is the default) using CSS. I’ve done this with the CSS on that page as:

    .socialtab li {
    	display: inline;
    	margin-right: 3px;
    }

    hope that helps!

    I want to add facebook login manually at the header, so what is the php tag? is it right: <?php if (function_exists(‘sfc_login’)) echo sfc_login();?>

    Thanks before

    Thread Starter derekbeck

    (@derekbeck)

    This thread is not about logging in with SFC, it is about the like button. Please post a new thread on this subject. (You can then alert me and/or Otto to draw us to it.)

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: Simple Facebook Connect]: manual useage does not keep variables set’ is closed to new replies.