public function ch_manage_project_task_posts_custom_column($column_name, $post_id) { if ($column_name == 'ch_project') { $arr_ids = get_post_meta($post_id, '_ch_task_project_ids'); foreach (array_unique($arr_ids) as $id) { $fund = PN_Project::getById($id); echo $fund->post->post_title . '<br>'; } } }
function meta_box_save($post_id) { if (in_array(get_post_type($post_id), $this->post_types)) { $project = PN_Project::getById($post_id); if (isset($_POST['_ch_project_url']) && !empty($_POST['_ch_project_url'])) { $project->set_project_url($_POST['_ch_project_url']); $project->save(); } else { $project->set_project_url(''); $project->save(); } } }
public function ch_restrict_manage_posts() { global $wpdb, $wp_query; $qv = $wp_query->query_vars; if ($qv['post_type'] == $this->post_type) { $projects = PN_Project::get_list(); echo '<select name="project_id">'; echo '<option value="">' . __('All projects', PLUGINNAME_DOMAIN) . '</option>'; foreach ($projects as $project) { $selected = (!empty($_GET['project_id']) and $_GET['project_id'] == $project->post->ID) ? 'selected="selected"' : ''; echo '<option value="' . $project->post->ID . '" ' . $selected . '>' . $project->post->post_title . '</option>'; } echo '</select>'; } }