I think this might be it. Not sure what I can change to use the permalink. Thanks very much for your help again. AJ
public static function get_social_share_links( $post_id = 0, $slug = ”, $network = ” ) {
// make sure we have a post ID or slug
if ( empty( $post_id ) && empty( $slug ) ) {
return;
}
// get my short link (if a post ID) or just the link if not
$link = ! empty( $post_id ) ? wp_get_shortlink( $post_id ) : get_post_type_archive_link( $slug );
// create the text to include
if ( ! empty( $post_id ) ) {
$text = str_replace( ‘ ‘, ‘ ‘, get_the_title( $post_id ) );
} else {
// fetch the object
$object = get_post_type_object( $slug );
// get the name portion
$name = $object->labels->name;
// build the text
$text = $slug !== ‘events’ ? ‘MEFA ‘ . $name : ‘Upcoming MEFA ‘ . $name;
}
// spit out the facebook
$facebook = ‘https://www.facebook.com/sharer/sharer.php?u=’ . $link;
// spit out twitter
$twitter = ‘https://twitter.com/intent/tweet?source=webclient&via=mefatweets&text=’ . esc_html( trim( $text ) ) . ‘&url=’ . urlencode( $link );
//spit out linkedin
$linkedin = ‘https://www.linkedin.com/shareArticle?mini=true&source=mefa&url=’ . $link;
// get the printing link
$printlink = ‘#print’;
// get the email share
$emaillink = ‘#email’;
// get the optional RSVP link
$rsvplink = self::get_event_rsvp_link( $post_id );
// make my array
$sharelinks = array(
‘facebook’ => $facebook,
‘twitter’ => $twitter,
‘linkedin’ => $linkedin,
’emaillink’ => $emaillink,
‘printlink’ => $printlink,
‘rsvplink’ => $rsvplink
);
// send it back
return $sharelinks;
}