Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Get npr stories on pull type #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions get_stories.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,16 @@ public function __construct() {
return;
}
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
add_action( 'load-posts_page_get-npr-stories', array( $this, 'load_page_hook' ) );
}

/**
* Register the admin menu for "Get NPR Stories"
* Register the admin menu for "Get NPR Stories" for the post type assigned as the "Pull Post Type"
*/
public function admin_menu() {
add_posts_page( 'Get NPR Stories', 'Get NPR Stories', 'edit_posts', 'get-npr-stories', 'nprstory_get_stories' );
$pull_post_type = $this->nprstory_get_pull_post_type();
$slug_args = ( $pull_post_type != 'post' ) ? "?post_type=$pull_post_type" : '';
$hook_suffix = add_submenu_page( "edit.php$slug_args", 'Get NPR Stories', 'Get NPR Stories', 'edit_posts', 'get-npr-stories', 'nprstory_get_stories' );
add_action( 'load-' . $hook_suffix, array( $this, 'load_page_hook' ) );
}

}
Expand Down
4 changes: 3 additions & 1 deletion get_stories_ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ function nprstory_update_column_content ( $column_name, $post_ID ) {
$retrieved = get_post_meta( $post_ID, NPR_RETRIEVED_STORY_META_KEY, true );
if ($retrieved) {
$api_id = get_post_meta( $post_ID, NPR_STORY_ID_META_KEY, TRUE );
echo ( '<a href="' . admin_url( 'edit.php?page=get-npr-stories&story_id=' .$api_id ) . '"> Update </a>' );
$pull_post_type = DS_NPR_API::nprstory_get_pull_post_type();
$post_type_arg = ($pull_post_type != 'post') ? "&post_type=$pull_post_type" : '';
echo ( '<a href="' . admin_url( 'edit.php?page=get-npr-stories&story_id=' .$api_id . $post_type_arg ) . '"> Update </a>' );
}
}
}
Expand Down