Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @sophiesaxlund,

    This can be placed anywhere you need a link to the post in your code. It can’t be used in the WP content editor or in the backend of WP. I would ask the plugin author to add this feature if you need it, or write a function that outputs that code and put it in functions.php

    I wouldn’t suggest changing the base plugin code @lisha56, as it will be overwritten on update and can also cause further issues down the road. I personally recommend writing a function that will output the link based on the post ID that can be placed in functions.php.

    cody123

    (@cody123)

    Sorry, I put the PHP close tag after the HTML. The proper markup would be:

    <?php
    $event_id = get_the_ID();
    $facebook_id = get_post_meta( $event_id, 'ife_facebook_event_id', true );
    ?>
    
    <a target="_blank" href="https://www.facebook.com/event/<?php echo $facebook_id; ?>">View Event on Facebook</a>
    
    cody123

    (@cody123)

    Hi @dadolux and @xylus,

    I had the same problem today and managed to figure it out after digging around in the plugin’s files.

    When an event is imported, the ID is saved in the meta data of the post. You can retrieve it by using the ife_facebook_event_id meta value stored in each post.

    For example:

    
    <?php
    $event_id = get_the_ID();
    $facebook_id = get_post_meta( $event_id, 'ife_facebook_event_id', true );
    
    <a target="_blank" href="https://www.facebook.com/event/<?php echo $facebook_id; ?>">View Event on Facebook</a>
    ?>
    

    Hope this helps anyone facing this issue. I would recommend updating the docs for this plugin to include this, as it’s a commonly used variable and feature. Great plugin!

    Cheers,
    Cody

    • This reply was modified 7 years ago by cody123.
    • This reply was modified 7 years ago by cody123. Reason: code update
    • This reply was modified 7 years ago by cody123. Reason: grammer
Viewing 3 replies - 1 through 3 (of 3 total)