I don't use facebook, so I'm sorry I can't help there. But with wordpress, where you paste the code depends on where you want the badge to show.
The first option is in the theme code (say, putting a flickr badge in your sidebar, like I did) - for that, you'd need to edit the right theme html page and then ftp that page to your web server.
The second option is to embed the badge in a post or page (like I did for my library) - to do that, you probably need to use the code view for posting, instead of the visual rich editor. But all you need to do is paste the code into the editor window, and it'll show up on that post/page.
I hope that helps. I know I'm only talking about flickr, but it should apply to any badge or widget. If you're having more specific problems, though, let me know. Good luck.