Facebook button in wordpress post + hidden content

sqallpl

Registered Member
Mar 6, 2009
61
5
I need to have a method to use a Facebook Like button inside the post with hidden content.

This should look like this:

User see the like button and the information that he needs to click it to see whole post

User clicks like button

Hidden part of the post (text, graphics, javascript) is unveiled




I know that its possible with html and javascript, but I dont know how to use it with wordpress.

Is there any other way without using a javascript? Im asking because wordpress has some problems with javascrit and its not easy.
 
you need javascript to my knowledge.

you could use a <php> include on your blog and have the javascript it links to, on another page of your server.

<?php include 'folder/javascript.js';?>

then the javascript code would be on your blog, and you could just add the html code wherever you want the like button and hidden .div to show up.



also maybe the reason the javascript isn't working is because you're not putting it in the <head></head> tags, that's where it should go to work properly. you can't just insert it into a blog post because it would be going inside the <body></body>
 
Last edited:
I made a post about hiding wordpress content a few months ago. I'm not allowed to post the url so here it is. I've also had to remove all urls from the post because I'm now not allowed to post them so will have to use google to search for the plugins.

Learnt a lot from here, so my first share!

A while ago I saw a post on hiding content to non fans on your Wordpress blog using a plugin from sociable.es however myself and most of the people on the thread it seemed couldn't get it to work properly using

Code:
<fb:fbml version="1.1">
Everyone sees.
<fb:visible-to-connection>
Hidden Content HERE
</fb:visible-to-connection>
</fb:fbml>

I tried for days to get it work following the instructions on the thread but had no luck, until I tried something different.

The problem I think is that <fb:visible-to-connection> doesn't work out of facebook (I might be wrong), so to make it work I needed to change the requirements.

Still using the plugin from esociable I made it so the posts would only be visible to those were logged in by using the Facebook.

Steps:

1. Install Plugin from sociable
2. Set up plugin and application (see site for install details)
3. Add Facebook Connect Widget to Sidebar
4. Install "PHP Exec" plugin (allows php code within the post)
5. On posts you want to hide use the following code:

Code:
<phpcode>
<?php if (is_user_logged_in()) { ?>
Hidden Content
<?php } else { ?>
What non logged in users see
eg. To access  this download, you must be <a href="javascript:FB.login(login_facebook);">logged in with Facebook (click here)</a>. 
<?php } ?>
</phpcode>

Now your post is protected and only users who give permission to your application to log in can see the content and you can set the permissions such as e-mails, friends lists, publish to wall etc...

If you want you can also block all posts with the same code just edit the singlepost.php in your template.

I hope this helps some of you out there. I wasn't able to make bank out of this technique as I suck at FB marketing so if this helps anyone and they fancy helping me out please PM me.

Not quite what you were looking for but it is a workaround.
 
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock