• Resolved commadelimited

    (@commadelimited)


    I want to add a new column for one of my custom post types that includes a deeplink to a suite of tools I’ve written. I’ve got it working, but for some reason it won’t display if the Admin Columns plugin is enabled. I’d like to continue using the Admin Columns plugin because it’s useful, but this new column is important as well.

    Is it possible to have a custom column that I’ve coded, living in my functions.php file, at the same as as the Admin Columns plugin is enabled?

    This is what I’ve implemented (redacted), I’m assuming that the plugin is overwriting my changes.

    function mm_add_{post_type}_tools_link($columns) {
    if ( current_user_can( 'manage_options' ) ) {
    $columns['new_column'] = 'Column Title'; // Add your column
    }
    return $columns;
    }
    add_filter('manage_{post_type}_posts_columns', 'mm_add_{post_type}_tools_link');

    function mm_populate_{post_type}_tools_link($column, $post_id) {
    $title = str_replace(' ', '%20', get_the_title($post_id));
    if ('new_column' === $column) {
    if (current_user_can( 'manage_options') ) {
    echo '<a target="_blank" href="http://www.google.com?q=' . $title . '">Column Title</a>';
    }
    }
    }
    add_action('manage_{post_type}_posts_custom_column', 'mm_populate_{post_type}_tools_link', 10, 2);
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.