GIANISM_VERSION
GIANISM_VERSION
Plugin version
gianism_message(int $user_id, string $body, int $from, string $subject) : bool
Save message to specified user
If user's email is pseudo one(e.g. example@pseudo.twitter.com),
WordPress's mail function wp_mail
fails.
This function is originally used for wp_mail
fallback.
But you can use this function to send message which will be
displayed on admin screen.
int | $user_id | |
string | $body | |
int | $from | |
string | $subject |
get_facebook_publish_permission_link(string $redirect_url, string $action, array $args) : string
Returns url to get Publish stream permission
This function itself has no effect without action hook. See example below:
// In some template, display button. get_facebook_publish_permission_link(get_permalink(), 'my_favorite_action', array('post_id' => get_the_ID())); // Then, hook action in functions.php in your theme. add_action('my_favorite_action', 'my_publish_action'); function my_publish_action($facebook, $args){ $post = get_post($args['post_id']); try{ $facebook->api("/me/feed", "POST", array( "message" => "I read this article!", "link" => get_permalink($post->ID), "name" => get_the_title($post->ID), "description" => strip_tags($post->post_content), "action" => json_encode(array( "name" => get_bloginfo('name'), "link" => home_url('/'))) )); }catch(FacebookApiException $e){ // Error wp_die($e->getMessage()); } }
string | $redirect_url | URL where user will be redirect afeter authentication |
string | $action | Action name which will be fired after authenticaction |
array | $args | Array which will be passed to action hook |
gianism_fb_admin_id() : int|string
Get admin facebook id
This will be user id or facebook page id.
// Example $fb = gianism_fb_admin(); if( !is_wp_error($fb) ){ $feed = $fb->api(gianism_fb_admin_id().'/feed'); foreach( $feed['data'] as $status ){ // Do stuff. } }
twitter_get_timeline(string $screen_name, array $additional_data) : object
Get twitter time line in JSON format object
Caching is recommended.
$timeline = get_transient('twitter_timeline'); if( false === $timeline){ $timeline = twitter_get_timeline('my_screen_name'); set_transient('twitter_timeline', $timeline, 3600); } foreach($timeline as $status){ // Echo status }
string | $screen_name | If not specified, admin user's screen name will be used. |
array | $additional_data |
JSON format object.