My homemade WordPress upload plugin for Luguo Image Hosting — Klink
Uploading images to Luguo Image Hosting saves bandwidth and space on my server. I couldn't find a WordPress plugin that did it in one click, so I wrote one = =
Download at the end of this post Luguo Image Hosting: http://imgchr.com/ (Note: this is free photo storage, not an advertisement. Luguo Image Hosting is well known and doesn't need me to advertise it!) This plugin was built using add_meta_box() and pup.js
One thing to note! When inserting images, switch the editor to Text mode, because the HTML code is inserted automatically!
pup.js URL: https://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://api.krunk.cn/krunk/sdk/pup.js" data-url="https://imgchr.com/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
add_meta_box( $id, $title, $callback, $post_type, $context,$priority, $callback_args );
?>
Parameters:
-
$id (string) (required) The Meta box's HTML “ID” attribute.
-
$title (string) (required) The Meta box title visible to the user.
-
$callback (callback) (required) The function that outputs 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 (the custom post type's slug).
-
$context (string) (optional) Where to display the Meta box (‘normal’, ‘advanced’, or ‘side’). Default: ‘advanced’.
-
$priority (string) (optional) The Meta box's display priority (‘high’, ‘core’, ‘default’, or ‘low’). Default: ‘default’.
-
$callback_args (array) (optional) Arguments to pass to the callback function. The callback function receives the $post object and any other arguments passed through this variable.
Plugin download:
Click to download Klink (leave a comment to request the source-code version)
Published 05/30/2018 · Krunk Zhou
Join the conversation