WordPress.org

Ready to get started?Download WordPress

Forums

manage/edit custom columns - function not being recognized (2 posts)

  1. danpkraus
    Member
    Posted 3 years ago #

    Hi all.

    I am trying to figure out why I keep getting an error with the following function when trying to add columns to my custom post type screen in the admin.

    I get an "Expecting '(' on line 10 error.

    -LINE 10 = "function lingerie-post_edit_columns($columns){"

    add_action("manage_posts_custom_column", "lingerie-post_columns");
    
    add_filter("manage_edit-lingerie-post_columns", "lingerie-post_edit_columns");
    
    function lingerie-post_edit_columns($columns){
        $columns = array(
            "cb" => "<input type=\"checkbox\" />",
            "title" => _x('Title', 'column name'),
            "categories" => __('Categories'),
            "post-tags" => __('Tags'),
            "designer-tags" => __('Tags'),
            "boutique-tags" => __('Tags'),
            "author" => __('Author'),
            "comments" => __('Comments'),
            "date" => __('Date'),
        );
        $columns['comments'] = '<div class="vers"><img alt="Comments" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>';
        return $columns;
    }

    I have no idea why I keep getting this error as I can see no missing '(' PLEASE help :)

    Thanx,
    Daniel

  2. liperuf
    Member
    Posted 2 years ago #

    Hi Daniel,

    You can't create functions with "-" character. Use "_" (underline) instead!

Topic Closed

This topic has been closed to new replies.

About this Topic