A homemade WordPress upload plugin for Chevereto image hosting
Uploading images to Chevereto is easy and saves bandwidth and other server resources. But I couldn't find a plugin for uploading directly from WordPress to the image host in one click, so I wrote one myself = =
Download at the end of the article My Imger image host: https://image.krunk.cn/ This plugin was built using the add_meta_box() function and pup.js.
Before inserting an image, switch the editor to Text mode so the plugin can insert the HTML automatically.
pup.js script URL: https://api.krunk.cn/krunk/sdk/pup.js. Finally, include the Luguo image-hosting upload code on the post page through meta_box:
<script async id="chevereto-pup-src" src="https://krunk.cn/krunk/sdk/pup.js" data-url="https://image-cdn.krunk.cn/upload" data-auto-insert="bbcode-embed-medium"></script>
The add_meta_box() function was added in WordPress 2.5 so plugin developers could add meta boxes to the administration interface.
Usage:
<?php</span> add\_meta\_box<span>(</span> <span>$id</span><span>,</span> <span>$title</span><span>,</span> <span>$callback</span><span>,</span> <span>$post\_type</span><span>,</span> <span>$context</span><span>,</span><span>$priority</span><span>,</span> <span>$callback\_args</span> <span>)</span><span>;</span> <span>?>
Parameters:
$id (string) (required) The HTML “ID” attribute of the meta box. $title (string) (required) The title of the meta box, visible to users. $callback (callback) (required) The function that outputs the HTML for the meta box. $post_type (string) (required) The post type on which to display the meta box: post, page, link, attachment, or a custom post type (its slug). $context (string) (optional) Where the meta box appears ('normal', 'advanced', or 'side'). Default: 'advanced'. $priority (string) (optional) The priority of the meta box ('high', 'core', 'default', or 'low'). Default: 'default'. $callback_args (array) (optional) Arguments passed to the callback function. The callback receives the $post object and any additional arguments supplied through this variable.
Plugin download:
https://github.com/KrunkZhou/Chevereto.com-WP-Upload
Mirror: Download
Published 04/20/2019 · Krunk Zhou
Join the conversation