Skip to content

Instantly share code, notes, and snippets.

@jtsternberg
Last active April 27, 2016 01:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtsternberg/1b83e43348cfe4ec08a3 to your computer and use it in GitHub Desktop.
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
<?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