Last active
April 27, 2016 01:34
-
-
Save jtsternberg/1b83e43348cfe4ec08a3 to your computer and use it in GitHub Desktop.
Make instagram imported posts' titles to be the date of the imported image
This file contains 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
<?php | |
/* | |
Plugin Name: DsgnWrks Instagram Importer - Make Title the Image Date | |
Plugin URI: http://dsgnwrks.pro/plugins/dsgnwrks-instagram-importer | |
Description: Set the title of your instagram posts to the date the image was taken | |
Author URI: http://dsgnwrks.pro | |
Author: DsgnWrks | |
Donate link: http://dsgnwrks.pro/give/ | |
Version: 0.1.0 | |
*/ | |
function dsgnwrks_qa_make_title_image_date( $import, $insta_image ) { | |
if ( isset( $import['post_title'] ) ) { | |
// http://php.net/manual/en/function.date.php | |
$date_format = 'Y-m-d H:i:s'; | |
$import['post_title'] = date( $date_format, $insta_image->created_time ); | |
} | |
return $import; | |
} | |
add_filter( 'dsgnwrks_instagram_pre_save', 'dsgnwrks_qa_make_title_image_date', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment