Erstellen Sie den Shortcode auf der Admin-Einstellungsseite

Ich entwickle gerade ein Plugin für meine Geschenkkarte, und ich bin sehr neu in WP. Ich habe die folgenden Codes und ich möchte ein Endbenutzerformular mit shortcodes erstellen und mit diesem Admin-Plugin sollte Admin in der Lage sein, fontcolor und Familie der Felder zu ändern.

Also ich möchte von hier fortfahren

class Giftcardsettings { /** * Holds the values to be used in the fields callbacks */ private $options; /** * Start up */ public function __construct() { add_action( 'admin_menu', array( $this, 'add_plugin_page' ) ); add_action( 'admin_init', array( $this, 'page_init' ) ); wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker-alpha', plugins_url( 'wp-color-picker-alpha.min.js', __FILE__ ), array( 'wp-color-picker' ), '1.0.0', true ); } /** * Add options page */ public function add_plugin_page() { // This page will be under "Settings" add_options_page( 'Giftcard', 'Plugin Giftcard Admin', 'manage_options', 'my-setting-admin', array( $this, 'create_admin_page' ) ); } //shortcodes /** * Options page callback */ public function create_admin_page() { // Set class property $this->options = get_option( 'manage_options' ); ?> 
ID ) ); // See if there's a media id already saved as post meta $your_img_id = get_post_meta( $post->ID, '_your_img_id', true ); // Get the image src $your_img_src = wp_get_attachment_image_src( $your_img_id, 'full' ); // For convenience, see if the array is valid $you_have_img = is_array( $your_img_src ); $target_dir = "backgroundimg"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 2500000) { echo "Sorry, your file is too large."; $uploadOk = 0; } ?> <input class="custom-img-id" name="custom-img-id" type="hidden" value=""/>

<a class="upload-custom-img " href="">
<a class="delete-custom-img " href="#">

options['message_text_field'] ) ? esc_attr( $this->options['message_text_field']) : 'rgb(0,0,7,4,e8)'; printf('<input type="text" class="color-picker" data-alpha="true" data-default-color="%s" name="plugin_settings[my_overlay]" value="%s"', $color, $color ); } /** * Get the settings option array and print one of its values */ public function to_field_callback() { printf( '', isset( $this->options['tofield'] ) ? esc_attr( $this->options['tofield']) : '' ); } public function my_overlay_callback() { $color = isset( $this->options['color_to_field'] ) ? esc_attr( $this->options['color_to_field']) : 'rgb(0,0,7,4,e8)'; printf('options['color_from_field'] ) ? esc_attr( $this->options['color_from_field']) : 'rgb(0,0,7,4,e8)'; printf('<input type="text" class="color-picker" data-alpha="true" data-default-color="%s" name="plugin_settings[my_overlay]" value="%s"', $color, $color ); } public function image_callback() { printf( '', isset( $this->options['imageurl'] ) ? esc_attr( $this->options['imageurl']) : '' ); } public function dimension_field_callback() { printf( '', isset( $this->options['dimensionfield'] ) ? esc_attr( $this->options['dimensionfield']) : '' ); } } if( is_admin() ) $my_settings_page = new Giftcardsettings(); ?>

Endcode. Auch das Hintergrundbild zum Hochladen des Bildes in das Frontend-Benutzerformular.

Solutions Collecting From Web of "Erstellen Sie den Shortcode auf der Admin-Einstellungsseite"