WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
Social sharing idividul events issue (42 posts)

  1. wambrose
    Member
    Posted 3 years ago #

    I've hunted around but can't find a solution to this:

    I'd like site visitors to be able to share each 'Single Event Page' on their favourite social network.

    However currently when the social buttons that I've placed on each 'single event page' are clicked only the URL of the main 'Event List Page' is shared.

    The permalink changes in my address bar on every 'single event page' so I don't see why this isn't passed on.

    I've tried several WP sharing plugins and also directly pasted sharing code from ADDTHIS on to the event pages with no success (though all my other non-event pages/post will 'share' fine). I hope I've explained this clearly and someone can help.

  2. Elronixx
    Member
    Posted 3 years ago #

    hey i got the same issue.... can you tell me what you've done till now?

    i did not even find the file to place the php wp sharing snippet....
    http://wordpress.org/support/topic/plugin-events-manager-php-snippet-on-single-event-page?replies=1#post-2138400

  3. wambrose
    Member
    Posted 3 years ago #

    No joy yet. I installed a few plugins that put social links at the top of every page but trying different plugins hasn't made a difference. It might be to do with the fact that all events pages are rendered from the same page. The address bar shows a unique URL for each event though - all I want is that link to be sent to facebook/twitter etc when someone clicks one of the social bookmarking buttons.

  4. Elronixx
    Member
    Posted 3 years ago #

    Hey ok i think it dont will work with these plugins, that put the button automatically in the post. you will need either the "<iframe>" facebook tag or the fb plugin, where you can set the button where you wish by putting <?php echo wpfblike(); ?> in any php file.

    ok so i think you will need a php code like above to put the button where you wish.
    theres just a big problem within em. because the single event pages are produced as html pages. if you put this php code into the formatting single event pages after #_notes in the dashboard you dont get any output.

    so you have to put it into source code and generate just something like #_notes (maybe #_social_share_buttons) and define it in the same php file as #notes as "<?php echo wpfblike(); ?> function". but i dont know where #_notes and how #_notes is genereated (i mean theres an input, sure, but what file says that the input is = #_notes)

  5. Elronixx
    Member
    Posted 3 years ago #

    ps.: i just took fb as example (same way should work with twitter, etc. once you defined a variable, should be easy to call and echo the function)

  6. wambrose
    Member
    Posted 3 years ago #

    Thanks for that. Though it means getting into the PHP much deeper than I'd hoped. Surely there's a way to do it without creating custom placeholders.

  7. wambrose
    Member
    Posted 3 years ago #

  8. wambrose
    Member
    Posted 3 years ago #

    oops! i put the link to the like button generator in brackets and it's mess up the above post :-)

    Anyway, responses or better solutions the OP welcome.

  9. wambrose
    Member
    Posted 3 years ago #

    ...and the same works for twitter:

    <a href="http://twitter.com/share" class="twitter-share-button" data-url="#_EVENTURL" data-text="#_NAME" data-count="none" data-via="BTBStorytelling">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

    Though for some reason the script call has to be after the link or the button displays 3 times.

    I pasted the above code into the single event format box after my #_NOTES section.

  10. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    to make social buttons work, you want to add them after the content from em_content filter.

    the event object is passed on there, so you can genearate the social media buttons pasing on the right url

  11. wambrose
    Member
    Posted 3 years ago #

    Thanks Marcus
    ok.. so that's why this above method has been working for me. I don't know how to implement your suggestion as I'm quite a novice with php an EM but I'll have a look.

    In layman's terms (if it's easy to do so) where is the best place to paste in the code for some addthis butons?

  12. wambrose
    Member
    Posted 3 years ago #

    Ok, my final post on this topic. It seems the easiest way is to use something like the following addthis code into your 'Single Event Format' box in EM settings.

    It's the version of the addthis code where you can specify the share URL and Title.

    <!-- AddThis Button BEGIN -->
    <div class="addthis_toolbox addthis_default_style "
    addthis:url="#_EVENTURL"
           addthis:title="#_NAME"
           addthis:description="#_NAME">
    <a href="*****_THIS IS WHERE THE LINK TO YOUR ADDTHIS PROFILE GOES_*****" class="addthis_button_compact">Share</a>
    <span class="addthis_separator">|</span>
    <a class="addthis_button_preferred_1"></a>
    <a class="addthis_button_preferred_2"></a>
    <a class="addthis_button_preferred_3"></a>
    <a class="addthis_button_tweet" tw:via="YOUR_TWITTER_USER_NAME"></a>
    <a class="addthis_button_facebook_like"></a>
    </div>
    <script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
    <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4dab4061606c6557"></script>
    <!-- AddThis Button END -->

    I got the 'addthis' code here.

  13. Elronixx
    Member
    Posted 3 years ago #

    hey unfortunately your solution doesn't work because i do not got an fb app ID. so registrated to get this app id but i always got an ERROR behind my like button ( you must registrate an admin or app id and write this app id in meta tags blabla.... ; i did this but always same error)

    so what i need is what marcus told: dd them after the content from em_content filter.

    so and this is where i stuck: http://wp-events-plugin.com/tutorials/overriding-event-page-content-with-filters/

    how do i Override Event Page Content With Filters?
    where i have to put the following code?

    function my_em_custom_content($content){
    	if( /* Do something here to decide whether to override */ ){
    		$content .= "Here, I'm adding this extra text to the end of my event content.";
    	}
    	//Whatever happens, you must return the $content variable, altered or not.
    	return $content;
    }
    add_filter('em_content','my_em_custom_content');

    just in an extra functions.php file in my theme? or in a file from events-manager? and what means "Do something here to decide whether to override". i dont want to override something, just to add the php snippet for social share buttons.

    maybe someone more gifted can make an add-on for social share buttons and explain me how it works :(

  14. wambrose
    Member
    Posted 3 years ago #

    I'm sorry to hear you're having issues. I didn't have to apply for a facebook app ID or change any PHP.

    I opened a free account with ADDTHIS and used they're help pages to make the sharing toolbox i wanted (including the tweet and fb like buttons). I included the code to specify the URL rather than just the page the toolbox is placed on. I put #_EVENTURL where the URL should be.

    Here is the contents of the EVENT LIST FORMAT field in EM settings:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Hope that's not too much code but I want to help.

    It works in IE, Chrome, Firefox and definately posts the links on my facebook page (no errors).

    Good luck

  15. wambrose
    Member
    Posted 3 years ago #

    so the answer was yes....too much code! lol

    Pastebin link here for the examplecode

  16. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    i hadn't thought about this but I guess I might find a way to make social buttons work on EM (although this would be a pro feature). Probably would make it integrate with another plugin e.g. sociable.

    any other plugin suggestions? I'd go for a mix of the most popular/stable/flexible one.

  17. Elronixx
    Member
    Posted 3 years ago #

    @wambrose:Ok well... if nothing else works, ill do it your way.... (although i dont want to create another "useless" account somewhere)
    i just had another issue besides the erros... the placeholder #_EVENTURL returns the url of the events list page and not the single event page. did you got the same error?

    so far i figured out how to add filter like marcus said.
    i have just one small problem:

    @marcus:the social button appears under the events list page and under the single events page.... but i just want it to be shown on single events page.
    what do i have to write in the if statement to exclude the events page list?(think would be the easiest way)

    function my_em_custom_content($content){
    	<strong>if( site != event list page ){</strong>
    		$content .= "Here, I'm adding this extra text to the end of my event content.";[...]
  18. judodesign
    Member
    Posted 3 years ago #

    Marcus, If you could add a "Facebook like" feature to the pro version, we would definitely buy it. For us, its all that's missing from your otherwise great plugin.

    Would love to hear if there is a quickfix in the meantime. All options above are beyond my capabilities!

    Thanks.

  19. bspr3663
    Member
    Posted 3 years ago #

    I couldn't get #_EVENTURL to work, so here is another way to do it.

    Sign up for addthis.com (it takes 3 minutes). Pick what style you want. Copy and pasting this code will not work, because you need to get your own addthis code.

    This is the code to get the url that is displaying. Make sure this is used in a php file (not in the event manager single event box. I put it in my header.php

    <?php
    function curPageURL() {
     $pageURL = 'http';
     if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     $pageURL .= "://";
     if ($_SERVER["SERVER_PORT"] != "80") {
      $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
     } else {
      $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
     }
     return $pageURL;
    }
    ?>

    Use this code where you need to show the page url

    <?php echo curPageURL();?>

    In the addthis site it will give extra options where you can add a specific url and will look something like this: (you'll notice I this <?php echo curPageURL();?> in place of the url)

    <div class="addthis_toolbox addthis_default_style " addthis:url="<?php echo curPageURL();?>">
    <a class="addthis_button_preferred_1"></a>
    <a class="addthis_button_preferred_2"></a>
    <a class="addthis_button_preferred_3"></a>
    <a class="addthis_button_preferred_4"></a>
    <a class="addthis_button_compact"></a>
    <a class="addthis_counter addthis_bubble_style"></a>
    </div>
    <script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
    <script type="text/javascript" src="your personalized addthis account will be here"></script>

    The finished product will look something like this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Remember to put this code in a php file, it won't read the php script in the event manager settings. Good luck.

  20. wambrose
    Member
    Posted 3 years ago #

    @bspr3663 would love to see what you came up with (your code was "moderated as per the Forum Rules".)

    My #_eventurl theory only worked for the tweet and facebook like button but not the facebook share and several others. Facebook won't accept any data given to it at the button it still scans the page for it's open graph meta data (which i have working and dynamically set for all pages). However, the meta data doesn't change between the events pages. I just end up sharing the main events page.

    So back to square 1?!

  21. wambrose
    Member
    Posted 3 years ago #

    I need to know how i can make the URL provided by get_permalink()
    (as used in my header to provide facebook with a URL) to actually point to the single event page rather than always giving the root events page.

  22. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    you should use $EM_Event->output('#_EVENTURL');

    $EM_Event should be globalized beorehand.

    i wont revisit this post because it's insanely long to read now, but know that we're working on this atm and plan to have a social media add-on, but this will be limited for pro users, hopefully within the week.

  23. wambrose
    Member
    Posted 3 years ago #

    I thought I should revisit this topic to share my solution:

    I didn't use Event Manager! Drastic I know but I didn't need to booking facility so I just create a custom post time with Custom Post Type UI plugin, created a meta box for entering event info with Verve Meta Boxes plugin and then followed a few tutorials to create the page templates to display the info.

    EM is fantastic out of the box but it may need to embrace custom post types at some point. Hope that helps someone :-)

  24. wambrose
    Member
    Posted 3 years ago #

    ***I should have read my post before submitting! Corrections:***

    I thought I should revisit this topic to share my solution:

    I didn't use Event Manager! Drastic I know but I didn't need THE booking facility so I just create a custom post TYPE with Custom Post Type UI plugin, created a box for entering event info with Verve Meta Boxes plugin and then followed a few tutorials to create the page templates to display the info.

    EM is fantastic out of the box but I can see how having events as posts is of major benefit. Hope that helps someone :-)

  25. nixnix
    Member
    Posted 2 years ago #

    Marcus, I have the same error and I'm desperated!! In what file should I put the $EM_Event->output('#_EVENTURL'); ?

    Cheers

  26. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    depends what you're trying to do, you can actually add buttons like the fb like button in your event formatand just use #_EVENTURL see last post by me, repost in a new topic if u have more issues.

    btw, next week, the beta should be out, plugins likesociable should work then with em.

  27. nixnix
    Member
    Posted 2 years ago #

    Marcus, I tried that but doesn't work :(
    When sharing it displays the whole event section, not the single event.
    You can check it out here: http://www.nix-nix.com/nuevo/events/?event_id=74

    The code I used for the sharing button is this:

    <a name="fb_share" type="icon_link"
       share_url="#_EVENTURL">Compartir en Facebook</a>
    <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"
            type="text/javascript">
    </script>

    Am I doing something wrong?

    Thanks!

  28. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    try this

    <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=194211367311517&xfbml=1"></script><fb:like href="#_EVENTURL" send="true" width="450" show_faces="true" font=""></fb:like>

    that definitely works. if not, note that you may want to remove the script bit if you use fb scripts elsewhere in your page, since it'd already have loaded it once.

  29. John
    Member
    Posted 2 years ago #

    @Marcus lot of thanks to you for EM........

  30. nixnix
    Member
    Posted 2 years ago #

    Thanks Marcus! But that's the like button, I need the sharing button :P

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic