0
我試圖更新functions.php與此,這是從網站上的附件插件直接複製的代碼,但我得到一個T_DOUBLE_ARROW語法錯誤,任何想法爲什麼? : - ?解析錯誤:語法錯誤,PHP中的意外T_DOUBLE_ARROW
<?php
function my_attachments($attachments)
{
$fields => array(
array(
'name' => 'title', // unique field name
'type' => 'text', // registered field type
'label' => __('Title', 'attachments'), // label to display
'default' => 'title', // default value upon selection
),
array(
'name' => 'caption', // unique field name
'type' => 'textarea', // registered field type
'label' => __('Caption', 'attachments'), // label to display
'default' => 'caption', // default value upon selection
),
);
$args = array(
// title of the meta box (string)
'label' => 'My Attachments',
// all post types to utilize (string|array)
'post_type' => array('post', 'page'),
// meta box position (string) (normal, side or advanced)
'position' => 'normal',
// meta box priority (string) (high, default, low, core)
'priority' => 'high',
// allowed file type(s) (array) (image|video|text|audio|application)
'filetype' => null, // no filetype limit
// include a note within the meta box (string)
'note' => 'Attach files here!',
// text for 'Attach' button in meta box (string)
'button_text' => __('Attach Files', 'attachments'),
// text for modal 'Attach' button (string)
'modal_text' => __('Attach', 'attachments'),
// which tab should be the default in the modal (string) (browse|upload)
'router' => 'browse',
// fields array
'fields' => $fields,
);
$attachments->register('my_attachments', $args); // unique instance name
}
add_action('attachments_register', 'my_attachments');
>
你的錯誤消息包含一個行號是在這裏 – 2013-02-26 13:24:52
必不可少的雙箭頭是這個東西:'=>' - 錯誤消息指出其中找到了一個但不是預期的行,最有可能的是一些其他人在那裏失蹤。 – Niko 2013-02-26 13:25:03
嗯什麼'$字段=>數組('做? – 2013-02-26 13:26:08