如何将缩略图放入数组中?

发布于 2024-12-14 14:59:59 字数 602 浏览 0 评论 0原文

我正在尝试将缩略图添加到自定义帖子类型(“轮子”)管理页面,并且我正在尝试使用数组来执行此操作(见下文)。

数组的“get_the_post-thumbnail”部分给了我问题,谁能告诉我我做错了什么?

add_filter( 'manage_edit-wheels_columns', 'asd_edit_wheels_columns' ) ;

function asd_edit_wheels_columns( $columns ) {

    $columns = array(
      'cb' => '<input type="checkbox" />',
      'title' => __( 'Wheel Name' ),
      'rim_spokes' => __( '# Spokes' ),
      'wheel_tire' => __( 'Tire Name' ),
      'date' => __( 'Date' )
      'get_the_post-thumbnail [(post-thumbnail)'] => __( 'Featured' )
       );
    return $columns;
}

I am trying to add Thumbnails to a custom post type ('wheels') admin page, and I am trying to do this with an array (see below).

The 'get_the_post-thumbnail' part of the array is giving me the problem, can anyone tell me what I am doing wrong?

add_filter( 'manage_edit-wheels_columns', 'asd_edit_wheels_columns' ) ;

function asd_edit_wheels_columns( $columns ) {

    $columns = array(
      'cb' => '<input type="checkbox" />',
      'title' => __( 'Wheel Name' ),
      'rim_spokes' => __( '# Spokes' ),
      'wheel_tire' => __( 'Tire Name' ),
      'date' => __( 'Date' )
      'get_the_post-thumbnail [(post-thumbnail)'] => __( 'Featured' )
       );
    return $columns;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2024-12-21 14:59:59

不太确定你到底想在那里做什么(这是关于某个框架的吗?),但我可以看到这一个可能的错误:

'get_the_post-thumbnail [(post-thumbnail)'] => __( 'Featured' )
                                         ^^

此时,你首先关闭引用,然后放置结束方括号。这应该会给你一个语法错误。我猜您想在字符串内包含括号,因此您应该交换字符。

编辑:

哦,也在 'date' => 之后__( 'Date' ),缺少逗号 (,)。

Not really sure what exactly you are trying to do there (is this about some framework?), but I can see this one possible error:

'get_the_post-thumbnail [(post-thumbnail)'] => __( 'Featured' )
                                         ^^

At that point, you first close the quotation, and then you put the closing square bracket. This should give you a syntax error. I guess you wanted to include the bracket inside of the string, so you should switch the characters around.

edit:

Oh an also after 'date' => __( 'Date' ), there is a comma (,) missing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文