php WordPress:创建TinyMCE自定义按钮

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php WordPress:创建TinyMCE自定义按钮相关的知识,希望对你有一定的参考价值。

<?php
/*
Plugin Name: Event Subscription
Description: Simple plugin to insert event subscription button on posts
Version: 2.1
Author: Sue Feng
Author URI: http://suefeng.net
License: no license needed
*/
function subscribe_to_event() {
    return '<a href="/subscription?keepThis=true&TB_iframe=true&width=470&height=200" class="thickbox"><img src="/wp-content/themes/yourtheme/images/notification-button.png" alt="Subscribe to Upcoming Events"></a>';
}
add_shortcode( 'event_subscription', 'subscribe_to_event');

add_action( 'init', 'eventSubscription_buttons' );
function eventSubscription_buttons() {
    add_filter( "mce_external_plugins", "eventSubscription_add_buttons" );
    add_filter( 'mce_buttons', 'eventSubscription_register_buttons' );
}
function eventSubscription_add_buttons( $plugin_array ) {
    $plugin_array['eventSubscription'] = plugin_dir_url(__FILE__) . 'EventSubscriptionTinyMCE.js';
    return $plugin_array;
}
function eventSubscription_register_buttons( $buttons ) {
    array_push( $buttons, 'eventSubscription' );
    return $buttons;
}

以上是关于php WordPress:创建TinyMCE自定义按钮的主要内容,如果未能解决你的问题,请参考以下文章

php WordPress:创建TinyMCE自定义按钮

php WordPress:创建TinyMCE自定义按钮

php WordPress:创建TinyMCE自定义按钮

php 将自定义按钮添加到TinyMCE以在Wordpress上创建自定义格式

php WordPress TinyMCE定制

php wordpress tinyMCE强制粘贴为文本