我已安装Attachments plugin (版本3.5.7)将多个图像上载到我的帖子类型“shop”中的帖子。
The problem:
由于某些原因,我无法单击附件插件打开的媒体库的插入按钮。
What I have tried to do to find/solve the problem:
<停用所有插件(附件插件除外)将我的主题更改为另一个主题也在本地环境(XAMPP)和Web服务器上进行了尝试
Things to notice:
<激活附件插件后,Wordpress会给出以下消息:该插件在激活期间生成181个字符的意外输出。如果您发现有“headers ready sent”消息,或者RSS提要出现问题或其他问题,请尝试此插件,然后禁用或删除。
在我的本地环境以及我的Web服务器a上,有很多“加载资源失败(404)”消息,因为图像不加载,因为它们不存在,但我认为这不是问题
Code in functions.php to create an instance for my "shop" post type
/**
* Registers attachments to shop
* post type with the attachments plugin
*/
function gtp_shop_attachments_register( $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(
\'label\' => __( \'Attachments\', \'gtp_translate\' ),
\'post_type\' => array( \'shop\' ),
\'position\' => \'normal\',
\'priority\' => \'high\',
\'filetype\' => null,
\'button_text\' => __( \'Attach images\', \'gtp_translate\' ),
\'modal_text\' => __( \'Attach\', \'gtp_translate\' ),
\'router\' => \'browse\',
\'post_parent\' => false,
\'fields\' => $fields,
);
$attachments->register( \'shop_attachments\', $args ); // unique instance name
}
add_action( \'attachments_register\', \'gtp_shop_attachments_register\' );