0
votes

I am writing a wordpress plugin that adds a custom field under the posts.

However, the other post columns (i.e., page title, page description, etc.) get overwritten and all output "Create Post". The column label is unaffected.

Here is a sample of my code:

if (isset($dl_pluginSeries)) {
    //Actions
    add_action('admin_menu', 'interpost_ap');
    # add_action('wp_head', array(&$dl_pluginSeries, 'addHeaderCode'), 1);
    add_action('aaaa/aaaaa.php',  array(&$dl_pluginSeries, 'init'));


function display_posts_stickiness( $column, $post_id ) {
    echo '<a target="_blank" href="',content_url(),'/plugins/aaaa/php/popup.php?post=',the_permalink(),'">Create Post</a><br />';
    }
    add_action( 'manage_posts_custom_column' , 'display_posts_stickiness', 10, 2 );
    //Filters
    #add_filter('the_content', array(&$dl_pluginSeries, 'addContent'),1); 
    # add_filter('get_comment_author', array(&$dl_pluginSeries, 'authorUpperCase'));

    function add_interpost_column($columns) {
        return array_merge( $columns, array('interarray' => __('Create a Post')) );
    }
    add_filter('manage_posts_columns' , 'add_interpost_column');
}

Any idea what is causing this?

Thanks!

1

1 Answers

0
votes

You should put an if statement around the echo statement.

if ('interarray' == $column) {
    echo 'foobar';
}

Added clarification: your display_posts_stickiness function gets called for each cell in the table, not just in column you added. So you have to check that the column id passed into your function matches the column id you added.