Follow

How to Add a Sharing Link

In Pugpig you can share each page in your app. You can set a page sharing link or an edition wide sharing link. If a page sharing link is set this will override an edition wide link. By default sharing is enabled and clicking the share button in the app will share a permalink to the page. You can change the link be adding the hook pugpig_page_sharing_link to your module. Return:

  • null to disable individual page sharing
  • an external url to link to that  
  • '  ' (whitespace) to share an image such as a screenshot.

If individual page sharing is disabled you can set an edition sharing link in the Edition Edit Page. If you return a whitespace you need to define what is been shared elsewhere using sharing_mode. See the hook pugpig_feed_post_custom_categories.

In the example below a custom field 'pugpig_sharing_url' is being added as the page sharing link. If this is set by the user a page will link to this. If this is not set no page sharing link will be available. In the second case if an edition sharing link has been set the sharing link in app will default to this.

add_filter('pugpig_page_sharing_link', 'customapp_page_sharing_link', 10, 2);
function customapp_page_sharing_link($link, $post) {
$updated_link = get_post_meta($post->ID, 'pugpig_sharing_url', true);
if(!empty($updated_link)) {
return $updated_link;
}

return null;
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk