Last active
August 29, 2015 14:10
-
-
Save hayashikejinan/5fe06a5498521b4d759a to your computer and use it in GitHub Desktop.
SNAP Twitter URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * SNAP plugin で保存された Twitter 画像の URL を得る関数 (参考: http://keisuke.tsukayoshi.com/blog/1642 | |
| * | |
| * Copyright (c) 2014 hayashikejinan (http://hayashikejinan.com) | |
| * This software is released under the MIT License. | |
| * http://opensource.org/licenses/mit-license.php | |
| * | |
| * @return string | |
| */ | |
| function get_snap_tw_img_url() { | |
| $tw_img_url = ''; | |
| if ( $post_meta = get_post_meta( get_the_ID(), 'snapTW', true ) ) { | |
| $tw_user_id = '[ツイッターID]'; | |
| $unserialize = maybe_unserialize( $post_meta ); | |
| $tw_image_id = $unserialize[0]['pgID']; | |
| if ( $tw_image_id ) { | |
| $tw_img_url = 'https://twitter.com/' . $tw_user_id . '/status/' . $tw_image_id . '/photo/1'; | |
| } | |
| } | |
| return esc_url( $tw_img_url ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment