Advertisement
DXR

Tribe Facebook event link

DXR
Nov 17th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. Step 1: Paste this into your theme's functions.php file:
  2. ============================
  3.  
  4. /**
  5. *Plugin: Tribe Facebook Events Importer
  6. *Checks if the event came from facebook
  7. */
  8. function is_fb_event(){
  9. $fbMeta=tribe_get_event_meta();
  10. $verifyString="facebook-importer";
  11. $result=true;
  12. if ($fbMeta['_EventOrigin']['0']==$verifyString){
  13. $result=true;
  14. return $result;
  15. }
  16. if ($fbMeta['_EventOrigin']['0']!=$verifyString){
  17. $result=false;
  18. return NULL;
  19. }
  20. }
  21.  
  22. /**
  23. *Plugin: Tribe Facebook Events Importer
  24. *Builds a button to the original facebook event page in the event's info page
  25. */
  26. function build_fb_link(){
  27. $fbMeta=tribe_get_event_meta();
  28. $eventID=$fbMeta['_FacebookID']['0'];
  29. echo "<dt><div class='fb'><a href='http://facebook.com/".$eventID."' target='_BLANK'>Join event on <b>Facebook</b></a></div></dt>";
  30. }
  31.  
  32. Step 2: Paste this into your theme's CSS file (or "events.css")
  33. =============================
  34.  
  35. #tribe-events-event-meta .fb {
  36.  
  37. background: url(http://www.mricons.com/store/png/111375_28291_32_facebook_logo_icon.png) #3B5998 10px 5px no-repeat;
  38. background-size:22px 22px!important;
  39. float:left;
  40. clear:left;
  41. font-weight:bold;
  42. width:145px;
  43. height:23px;
  44. padding: 7px 0px 0px 38px;
  45. margin: 0 0 20px 30px;
  46. -webkit-border-radius: 4px;
  47. -moz-border-radius: 4px;
  48. border-radius: 4px;
  49. }
  50.  
  51. #tribe-events-event-meta .fb a{
  52. color: #ffffff!important;
  53. }
  54.  
  55. #tribe-events-event-meta .fb a:hover{
  56. text-decoration:underline;
  57. }
  58.  
  59. ==============================
  60.  
  61. Step 3: Paste this into your "single.php" file in your "plugins/the-events-calendar/views/" folder between line 84 and 85
  62. ==============================
  63.  
  64. if (is_fb_event()==true){build_fb_link();}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement