0

The title is showing but the content is empty.. I tried following few tutorials time after time but i guess i miss something.. How can i get it to echo 'test' on each col please?

// ADD NEW COLUMN
function pslider_columns_head($defaults) {
    $defaults['show_on_page'] = 'Shown on page';
    return $defaults;
}

// SHOW THE VALUE
function pslider_columns_content($column_name, $post_ID) {
    if ($column_name == 'show_on_page') {
        echo 'test';
    }
}

add_filter('manage_posts_columns', 'pslider_columns_head');
add_action('manage_posts_custom_column', 'pslider_columns_content', 10, 2);
3
  • Your code works perfectly here. It adds a nuew columen with "Show on page" title; each row is filled with "test".
    – cybmeta
    Commented Jan 26, 2016 at 15:25
  • But i don't understand why this code won't add it.. What am i missing?
    – Nate
    Commented Jan 26, 2016 at 17:03
  • As I said, it adds the column and echoes "test" correctly. Your problem is not in the coded you have posted.
    – cybmeta
    Commented Jan 26, 2016 at 18:49

1 Answer 1

0

I have found my problem.. The website was using a plugin for adding the new post types and they were set to Hierarchical. Once i changed that everything started to work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.