This repository has been archived by the owner on Mar 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from fastmover/master
Added auto tagging
- Loading branch information
Showing
3 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,7 +97,7 @@ function query_by_url( $url ) { | |
* @param bool $publish | ||
* @return int|null $post_id or null | ||
*/ | ||
function update_posts_from_stories( $publish = TRUE ) { | ||
function update_posts_from_stories( $publish = TRUE, $qnum = false ) { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
$pull_post_type = get_option( 'ds_npr_pull_post_type' ); | ||
if ( empty( $pull_post_type ) ) { | ||
$pull_post_type = 'post'; | ||
|
@@ -154,6 +154,9 @@ function update_posts_from_stories( $publish = TRUE ) { | |
'post_type' => $pull_post_type, | ||
'post_date' => $post_date, | ||
); | ||
if( false !== $qnum ) { | ||
This comment has been minimized.
Sorry, something went wrong.
mikeschinkel
Contributor
|
||
$args['tags_input'] = get_option('ds_npr_query_tags_'.$qnum); | ||
} | ||
//check the last modified date and pub date (sometimes the API just updates the pub date), if the story hasn't changed, just go on | ||
if ( $post_mod_date != strtotime( $story->lastModifiedDate->value ) || $post_pub_date != strtotime( $story->pubDate->value ) ) { | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ public static function nprstory_cron_pull() { | |
if ( $pub_option == 'Publish' ) { | ||
$pub_flag = TRUE; | ||
} | ||
$story = $api->update_posts_from_stories($pub_flag); | ||
$story = $api->update_posts_from_stories($pub_flag, $i); | ||
This comment has been minimized.
Sorry, something went wrong.
mikeschinkel
Contributor
|
||
} else { | ||
if ( empty($story) ) { | ||
error_log('NPR Story API: not going to save story. Query '. $query_string .' returned an error '.$api->message->id. ' error'); // debug use | ||
|
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
Instead of using
$qnum
here, why not use$opts=array()
to future proof this?Inside of the method use
$opts=wp_parse_args($opts,array('query_number' => false));
I added these changes to my latest PR.