Skip to content

Instantly share code, notes, and snippets.

Last active Mar 11, 2019
What would you like to do?
Plugin Name: Show Text
Plugin URI:
Description: プラグイン開発説明用のプラグイン
Author: k.ishiwata
Version: 0.1
Author URI:
class ShowText {
function __construct() {
add_action('admin_menu', array($this, 'add_pages'));
function add_pages() {
add_menu_page('テキスト設定','テキスト設定', 'level_8', __FILE__, array($this,'show_text_option_page'), '', 26);
function show_text_option_page() {
if ( isset($_POST['showtext_options'])) {
$opt = $_POST['showtext_options'];
update_option('showtext_options', $opt);
?><div class="updated fade"><p><strong>テキストを保存しました。</strong></p></div><?php
<div class="wrap">
<div id="icon-options-general" class="icon32"><br /></div><h2>テキスト設定</h2>
<form action="" method="post">
$opt = get_option('showtext_options');
$show_text = isset($opt['text']) ? $opt['text']: null;
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="inputtext">テキスト</label></th>
<td><input name="showtext_options[text]" type="text" id="inputtext" value="<?php echo $show_text ?>" class="regular-text" /></td>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存" /></p>
<!-- /.wrap --></div>
function get_text() {
$opt = get_option('showtext_options');
return isset($opt['text']) ? $opt['text']: null;
$showtext = new ShowText;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment