Skip to content

Instantly share code, notes, and snippets.

@jayarjo
Created February 2, 2013 09:13
Show Gist options
  • Save jayarjo/4696711 to your computer and use it in GitHub Desktop.
Save jayarjo/4696711 to your computer and use it in GitHub Desktop.
wp: add/modify columns in post type listing screens
function f__manage_posts_columns($cols)
{
global $typenow;
if ($typenow != 'price_table')
return $cols;
$cols = array(
'cb' => $cols['cb'],
'title' => $cols['title'],
'template' => "Template",
'shortcode' => "Shortcode",
'date' => $cols['date'],
);
return $cols;
}
function a_10_2__manage_posts_custom_column($col_name, $post_id)
{
global $typenow;
if ($typenow != 'price_table')
return $cols;
if ($col_name == 'shortcode') {
?><code><strong>[price_table id="<?php echo $post_id; ?>"]</strong></code><?php
} elseif ($col_name == 'template') {
echo "Default";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment