如何将缩略图放入数组中?
我正在尝试将缩略图添加到自定义帖子类型(“轮子”)管理页面,并且我正在尝试使用数组来执行此操作(见下文)。
数组的“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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不太确定你到底想在那里做什么(这是关于某个框架的吗?),但我可以看到这一个可能的错误:
此时,你首先关闭引用,然后放置结束方括号。这应该会给你一个语法错误。我猜您想在字符串内包含括号,因此您应该交换字符。
编辑:
哦,也在
'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:
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.