当前位置: 首页>>代码示例>>PHP>>正文


PHP shortcode_ui_register_for_shortcode函数代码示例

本文整理汇总了PHP中shortcode_ui_register_for_shortcode函数的典型用法代码示例。如果您正苦于以下问题:PHP shortcode_ui_register_for_shortcode函数的具体用法?PHP shortcode_ui_register_for_shortcode怎么用?PHP shortcode_ui_register_for_shortcode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了shortcode_ui_register_for_shortcode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ccb_chapter_shortcode_register

function ccb_chapter_shortcode_register()
{
    add_shortcode('ccb_chapter', function ($attr) {
        $attr = wp_parse_args($attr, array('title' => '', 'background_image' => ''));
        ob_start();
        $title = $attr['title'];
        $bg_id = $attr['background_image'];
        $bg = '';
        $class = 'ccb ccb-chapter';
        if ($bg_id) {
            $bg = wp_get_attachment_image_src($bg_id, 'large');
            $class .= ' ccb-chapter-has-image';
        }
        ?>
		<?php 
        do_action('ccb_chapter_outside_before');
        ?>
		<section class="<?php 
        echo $class;
        ?>
" data-chapter-title="<?php 
        echo esc_attr($title);
        ?>
">
			<?php 
        do_action('ccb_chapter_inside_before');
        ?>
            <?php 
        if ($bg_id) {
            echo '<div class="ccb-chapter-image" style="background-image: url(' . $bg[0] . ');"><h1 class="chapter-title">' . $title . '</h1></div>';
        } else {
            echo '<h1 class="chapter-title">' . $title . '</h1>';
        }
        ?>
			<?php 
        do_action('ccb_chapter_inside_after');
        ?>
            <?php 
        if (is_admin()) {
            echo '<style>.ccb-chapter-has-image .chapter-title{height: 400px!important;}</style>';
        }
        ?>
		</section>
		<?php 
        do_action('ccb_chapter_outside_after');
        ?>

		<?php 
        return ob_get_clean();
    });
    if (!function_exists('shortcode_ui_register_for_shortcode')) {
        add_action('admin_notices', function () {
            if (current_user_can('activate_plugins')) {
                echo '<div class="error message"><p>You need Shortcake (Shortcode UI) in order to use CAP Content Blocks.</p></div>';
            }
        });
        return;
    }
    shortcode_ui_register_for_shortcode('ccb_chapter', array('label' => 'Chapter', 'listItemImage' => 'dashicons-editor-ol', 'post_type' => array('reports'), 'attrs' => array(array('label' => 'Title', 'attr' => 'title', 'type' => 'text', 'meta' => array('placeholder' => 'Chapter #', 'data-test' => 1)), array('label' => 'Chapter Background', 'attr' => 'background_image', 'type' => 'attachment', 'libraryType' => array('image'), 'addButton' => 'Select Image', 'frameTitle' => 'Select Image'))));
}
开发者ID:amprog,项目名称:cap-content-blocks,代码行数:60,代码来源:chapter.php

示例2: sandwich_myshortcode

function sandwich_myshortcode()
{
    // TODO: Does your Shortcake require additional functions for rendering?
    // Most existing plugins using shortcodes can be rendered by shortcake itself.
    // However, plugins created from scratch will require the following add_shortcode module below.
    // Delete this TODO message along with the following function below if it is not needed, and
    // DO NOT FORGET TO DELETE THE SHORTCODE INITIALIZATION BELOW THIS!
    // Register shortcode for <FRIENDLY_PLUGIN_NAME>
    add_shortcode('pbs_myshortcode', 'sandwich_myshortcode_shortcode');
    // Check if Shortcake exists
    if (!function_exists('shortcode_ui_register_for_shortcode')) {
        return;
    }
    // Ensure plugin runs only in admin mode. Do not continue if that's not the case.
    if (!is_admin()) {
        return;
    }
    // TODO: If creating a Shortcake for a particular plugin, find its class and use it as basis of activation.
    // This module must terminate the moment it determines that the dependency is not established.
    // Calling undefined classes and functions will result in errors, so this must be handled.
    // Delete this TODO module when done and the dependency check has been written and tested working.
    // Insert the dependency check below this line.
    // Register Shortcake UI for <FRIENDLY_PLUGIN_NAME>
    shortcode_ui_register_for_shortcode('pbs_myshortcode', array('label' => __('<FRIENDLY_PLUGIN_NAME>', 'pbsandwich'), 'listItemImage' => 'dashicons-wordpress', 'attrs' => array(array('label' => __('Some Text', 'pbsandwich'), 'attr' => 'some_text', 'type' => 'text'), array('label' => __('Some Color', 'pbsandwich'), 'attr' => 'some_color', 'type' => 'color', 'value' => '#333333')), 'inner_content' => array('label' => __('Content', 'pbsandwich'), 'value' => '', 'type' => 'textarea')));
    // TODO: If the rendered shortcode in the editor NEEDS to be previewed in a logged out state (e.g. login forms)
    // uncomment this and add in your shortcode here.
    // sandwich_add_logged_out_shortcode( 'pbs_myshortcode' );
}
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:28,代码来源:template.php

示例3: admin_init

 /**
  * Register a Shortcake ui if we can
  */
 public function admin_init()
 {
     if (!function_exists('shortcode_ui_register_for_shortcode')) {
         return;
     }
     shortcode_ui_register_for_shortcode('chart', array('label' => esc_html__('Charts', 'm-chart'), 'listItemImage' => 'dashicons-chart-pie', 'attrs' => array(array('label' => esc_html__('Chart', 'm-chart'), 'attr' => 'id', 'type' => 'post_select', 'query' => array('post_type' => m_chart()->slug, 'post_status' => 'publish')))));
 }
开发者ID:truesibo,项目名称:m-chart,代码行数:10,代码来源:class-m-chart-admin.php

示例4: sandwich_myshortcode

function sandwich_myshortcode()
{
    // No need to register our shortcode since it already exists
    // Check if Shortcake exists
    if (!function_exists('shortcode_ui_register_for_shortcode')) {
        return;
    }
    // Only create the UI when in the admin
    if (!is_admin()) {
        return;
    }
    // Register Shortcake UI
    shortcode_ui_register_for_shortcode('myshortcode', array('label' => __('Some Existing Shortcode', 'pbsandwich'), 'listItemImage' => 'dashicons-wordpress', 'attrs' => array(array('label' => __('Content', 'pbsandwich'), 'attr' => 'content', 'type' => 'textarea'), array('label' => __('Some Text', 'pbsandwich'), 'attr' => 'some_text', 'type' => 'text'), array('label' => __('Some Color', 'pbsandwich'), 'attr' => 'some_color', 'type' => 'color', 'value' => '#333333'))));
    // TODO: If the rendered shortcode in the editor NEEDS to be previewed in a logged out state (e.g. login forms)
    // uncomment this and add in your shortcode here.
    // sandwich_add_logged_out_shortcode( 'myshortcode' );
    // Make sure Jetpack is activated
    if (!class_exists('Jetpack')) {
        add_action('print_media_templates', 'sandwich_jetpack_myshortcode_disabled');
        return;
    }
    // Make sure our required Jetpack module is turned on
    if (!Jetpack::is_module_active('some-jetpack-module')) {
        add_action('print_media_templates', 'sandwich_jetpack_myshortcode_disabled');
        return;
    }
}
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:27,代码来源:template-jetpack.php

示例5: register

 /**
  * Register the shortcode UI handler function with WordPress.
  *
  * @since 0.1.0
  *
  * @param mixed $context Data about the context in which the call is made.
  * @return void
  */
 public function register($context = null)
 {
     if (!$this->is_needed()) {
         return;
     }
     \shortcode_ui_register_for_shortcode($this->shortcode_tag, $this->config);
 }
开发者ID:brightnucleus,项目名称:shortcodes,代码行数:15,代码来源:ShortcodeUI.php

示例6: sandwich_events_manager

function sandwich_events_manager()
{
    // Check if Shortcake exists
    if (!function_exists('shortcode_ui_register_for_shortcode')) {
        return;
    }
    // Ensure plugin runs only in admin mode. Do not continue if that's not the case.
    if (!is_admin()) {
        return;
    }
    // Dependency check for Events Manager. Do not proceed if not found.
    if (!defined('EM_VERSION')) {
        return;
    }
    // Register Shortcake UI for Events Manager Events List
    shortcode_ui_register_for_shortcode('events_list', array('label' => __('Events Manager Events List', 'pbsandwich'), 'listItemImage' => 'dashicons-calendar', 'attrs' => array(array('label' => __('Event listing limit', 'pbsandwich'), 'attr' => 'limit', 'type' => 'text', 'value' => '10', 'description' => __('Show up to the specified amount of events.', 'pbsandwich'))), 'inner_content' => array('label' => __('Event List caption', 'pbsandwich'), 'value' => '', 'type' => 'textarea', 'description' => __('The Event List can be customized to include customized description. The following variables will be replaced with the actual relevant details:<br />#_EVENTNAME<br />#_EVENTLINK<br />#_LOCATIONLINK<br />#_EVENTDATES<br />#_EVENTTIMES', 'pbsandwich'))));
    // Register Shortcake UI for Events Manager Grouped Events List
    shortcode_ui_register_for_shortcode('events_list_grouped', array('label' => __('Events Manager Grouped Events List', 'pbsandwich'), 'listItemImage' => 'dashicons-calendar', 'attrs' => array(array('label' => __('Event listing mode', 'pbsandwich'), 'attr' => 'mode', 'type' => 'select', 'options' => sandwich_events_manager_mode_selection(), 'description' => __('Show events by these selections.', 'pbsandwich'))), 'inner_content' => array('label' => __('Grouped Event List caption', 'pbsandwich'), 'value' => '', 'type' => 'textarea', 'description' => __('The Grouped Events List can be customized to include customized description. The following variables will be replaced with the actual relevant details:<br />#_EVENTDATES<br />#_EVENTLINK<br />#_EVENTTIMES', 'pbsandwich'))));
    // Register Shortcake UI for Events Manager Event Display
    shortcode_ui_register_for_shortcode('event', array('label' => __('Events Manager Event Display', 'pbsandwich'), 'listItemImage' => 'dashicons-calendar', 'attrs' => array(array('label' => __('Show Event', 'pbsandwich'), 'attr' => 'post_id', 'type' => 'select', 'options' => sandwich_functions_posttype_list('event'))), 'inner_content' => array('label' => __('Event caption', 'pbsandwich'), 'value' => '#_EVENTNAME', 'type' => 'textarea', 'description' => __('The Event display can be customized to include elements like description. The #_EVENTNAME  variable will be replaced with the actual content.', 'pbsandwich'))));
    // Register Shortcake UI for Events Manager Event Form
    shortcode_ui_register_for_shortcode('event_form', array('label' => __('Events Manager Event Submission Form', 'pbsandwich'), 'listItemImage' => 'dashicons-calendar', 'attrs' => array()));
    // Register Shortcake UI for Events Manager Event Search Form
    shortcode_ui_register_for_shortcode('event_search_form', array('label' => __('Events Manager Event Search Form', 'pbsandwich'), 'listItemImage' => 'dashicons-calendar', 'attrs' => array()));
    // Register Shortcake UI for Events Manager Events Calendar
    shortcode_ui_register_for_shortcode('events_calendar', array('label' => __('Events Manager Events Calendar', 'pbsandwich'), 'listItemImage' => 'dashicons-calendar', 'attrs' => array(array('label' => __('Show Full-sized Calendar', 'pbsandwich'), 'attr' => 'full', 'type' => 'checkbox', 'value' => '0'), array('label' => __('Show long events', 'pbsandwich'), 'attr' => 'long_events', 'type' => 'checkbox', 'value' => '0'), array('label' => __('Category List', 'pbsandwich'), 'attr' => 'category', 'type' => 'select', 'options' => sandwich_functions_term_list('event-categories'), 'description' => __('Show events in the specified category.', 'pbsandwich')))));
}
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:27,代码来源:events-manager.php

示例7: pp_passreset_shortcode_shortcake

function pp_passreset_shortcode_shortcake()
{
    if (!function_exists('shortcode_ui_register_for_shortcode')) {
        return;
    }
    shortcode_ui_register_for_shortcode('user-login', array('label' => 'Password Reset Form: Username / Email field', 'listItemImage' => 'dashicons-admin-users', 'attrs' => array(array('label' => 'CSS class', 'attr' => 'class', 'type' => 'text', 'description' => 'CSS class for the field.'), array('label' => 'CSS ID', 'attr' => 'id', 'type' => 'text', 'description' => 'CSS id for the field.'), array('label' => 'Title', 'attr' => 'title', 'type' => 'text', 'description' => 'Title attribute for the input field.'), array('label' => 'Placeholder', 'attr' => 'placeholder', 'type' => 'text', 'description' => 'Placeholder attribute for the input field.'), array('label' => 'Value', 'attr' => 'value', 'type' => 'text', 'description' => 'Value attribute (default field text).'))));
    shortcode_ui_register_for_shortcode('reset-submit', array('label' => 'Password Reset Form: Submit Button', 'listItemImage' => 'dashicons-cart', 'attrs' => array(array('label' => 'CSS class', 'attr' => 'class', 'type' => 'text', 'description' => 'CSS class for the field.'), array('label' => 'CSS ID', 'attr' => 'id', 'type' => 'text', 'description' => 'CSS id for the field.'), array('label' => 'Title', 'attr' => 'title', 'type' => 'text', 'description' => 'Title attribute for the input field.'), array('label' => 'Value', 'attr' => 'value', 'type' => 'text', 'description' => 'Submit button text.'))));
}
开发者ID:bangjojo,项目名称:wp,代码行数:8,代码来源:shortcake.php

示例8: setup_shortcode_ui

 /**
  * Configure support for the blockquote shortcode with Shortcode UI.
  */
 public function setup_shortcode_ui()
 {
     if (!function_exists('shortcode_ui_register_for_shortcode')) {
         return;
     }
     $args = array('label' => 'Blockquote', 'listItemImage' => 'dashicons-editor-quote', 'post_type' => array('post', 'page'), 'inner_content' => array('label' => 'Blockquote text'), 'attrs' => array(array('label' => 'Source', 'attr' => 'cite', 'type' => 'text'), array('label' => 'Image (Optional)', 'attr' => 'image', 'type' => 'attachment', 'libraryType' => array('image'), 'addButton' => 'Select Image', 'frameTitle' => 'Select Image'), array('label' => 'Image placement', 'attr' => 'image_placement', 'type' => 'select', 'description' => 'Choose where the image, if one is provided, should be displayed.', 'options' => array('' => 'Text in column one, image in column two', 'reverse' => 'Image in column one, text in column two', 'together' => 'Image and text in a single column')), array('label' => 'Wrapper class', 'attr' => 'wrapper', 'type' => 'text', 'description' => 'If provided, a class will be added to the wrapping container. Classes blockquote-container and blockquote-has-image are aready placed automatically.')));
     shortcode_ui_register_for_shortcode('ip_blockquote', $args);
 }
开发者ID:ssheilah,项目名称:ip.wsu.edu,代码行数:11,代码来源:shortcode-blockquote.php

示例9: register_shortcode

 public function register_shortcode()
 {
     add_shortcode(self::$shortcode_tag, array($this, 'callback'));
     // If Shortcake is installed and activated, add support for a post element
     if (function_exists('shortcode_ui_register_for_shortcode')) {
         shortcode_ui_register_for_shortcode(self::$shortcode_tag, self::get_shortcode_ui_args());
     }
 }
开发者ID:ryanboswell,项目名称:wordpress-github-repos,代码行数:8,代码来源:class-github-repos.php

示例10: shortcodeUI

 /**
  * Describe shortcode for Shortcake UI
  *
  * @since 1.1.0
  *
  * @link https://github.com/fusioneng/Shortcake Shortcake UI
  *
  * @return void
  */
 public static function shortcodeUI()
 {
     // Shortcake required
     if (!function_exists('shortcode_ui_register_for_shortcode')) {
         return;
     }
     shortcode_ui_register_for_shortcode(static::SHORTCODE_TAG, array('label' => esc_html(__('Follow Button', 'twitter')), 'listItemImage' => 'dashicons-twitter', 'attrs' => array(array('attr' => 'screen_name', 'label' => esc_html(__('Twitter @username', 'twitter')), 'type' => 'text', 'meta' => array('placeholder' => 'WordPress', 'pattern' => '[A-Za-z0-9_]{1,20}')), array('attr' => 'size', 'label' => esc_html(__('Button size:', 'twitter')), 'type' => 'radio', 'value' => '', 'options' => array('' => esc_html(_x('medium', 'medium size button', 'twitter')), 'large' => esc_html(_x('large', 'large size button', 'twitter')))))));
 }
开发者ID:vrundakansara,项目名称:wordpress-2,代码行数:17,代码来源:Follow.php

示例11: shortcodeUI

 /**
  * Describe shortcode for Shortcake UI
  *
  * @since 1.1.0
  *
  * @link https://github.com/fusioneng/Shortcake Shortcake UI
  *
  * @return void
  */
 public static function shortcodeUI()
 {
     // Shortcake required
     if (!function_exists('shortcode_ui_register_for_shortcode')) {
         return;
     }
     shortcode_ui_register_for_shortcode(static::SHORTCODE_TAG, array('label' => esc_html(__('Tweet Button', 'twitter')), 'listItemImage' => 'dashicons-twitter', 'attrs' => array(array('attr' => 'text', 'label' => esc_html(_x('Text', 'Share / Tweet text', 'twitter')), 'type' => 'text'), array('attr' => 'url', 'label' => 'URL', 'type' => 'url'), array('attr' => 'size', 'label' => esc_html(__('Button size:', 'twitter')), 'type' => 'radio', 'value' => '', 'options' => array('' => esc_html(_x('medium', 'medium size button', 'twitter')), 'large' => esc_html(_x('large', 'large size button', 'twitter')))))));
 }
开发者ID:kaushikanurag,项目名称:wordpress,代码行数:17,代码来源:Share.php

示例12: register_shortcode

 /**
  * Register the [img] shortcode and the UI for it..
  *
  */
 private function register_shortcode()
 {
     add_shortcode('img', 'Img_Shortcode::callback');
     if (function_exists('shortcode_ui_register_for_shortcode')) {
         shortcode_ui_register_for_shortcode('img', Img_Shortcode::get_shortcode_ui_args());
     } else {
         add_action('admin_notices', array($this, 'action_admin_notices_warning'));
     }
 }
开发者ID:davisshaver,项目名称:image-shortcake,代码行数:13,代码来源:image-shortcake.php

示例13: shortcode_ui_dev_advanced_example

/**
 * An example shortcode with many editable attributes (and more complex UI)
 */
function shortcode_ui_dev_advanced_example()
{
    /**
     * Register UI for your shortcode
     *
     * @param string $shortcode_tag
     * @param array $ui_args
     */
    shortcode_ui_register_for_shortcode('shortcake_dev', array('label' => esc_html__('Shortcake Dev', 'shortcode-ui'), 'listItemImage' => 'dashicons-editor-quote', 'post_type' => array('post'), 'inner_content' => array('label' => esc_html__('Quote', 'shortcode-ui'), 'description' => esc_html__('Include a statement from someone famous.', 'shortcode-ui')), 'attrs' => array(array('label' => esc_html__('Attachment', 'shortcode-ui'), 'attr' => 'attachment', 'type' => 'attachment', 'libraryType' => array('image'), 'addButton' => esc_html__('Select Image', 'shortcode-ui'), 'frameTitle' => esc_html__('Select Image', 'shortcode-ui ')), array('label' => esc_html__('Citation Source', 'shortcode-ui'), 'attr' => 'source', 'type' => 'text', 'encode' => true, 'meta' => array('placeholder' => esc_html__('Test placeholder', 'shortcode-ui'), 'data-test' => 1)), array('label' => esc_html__('Select Page', 'shortcode-ui'), 'attr' => 'page', 'type' => 'post_select', 'query' => array('post_type' => 'page'), 'multiple' => true))));
}
开发者ID:benoitchantre,项目名称:Shortcake,代码行数:13,代码来源:dev.php

示例14: shortcodeUI

 /**
  * Describe shortcode for Shortcake UI
  *
  * @since 1.1.0
  *
  * @link https://github.com/fusioneng/Shortcake Shortcake UI
  *
  * @return void
  */
 public static function shortcodeUI()
 {
     // Shortcake required
     if (!function_exists('shortcode_ui_register_for_shortcode')) {
         return;
     }
     // id only
     // avoids an unchecked Shortcake input checkbox requiring a shortcode output
     shortcode_ui_register_for_shortcode(self::SHORTCODE_TAG, array('label' => __('Embedded Tweet Video', 'twitter'), 'listItemImage' => 'dashicons-twitter', 'attrs' => array(array('attr' => 'id', 'label' => 'ID', 'type' => 'text', 'meta' => array('required' => true, 'pattern' => '[0-9]+', 'placeholder' => '560070183650213889')))));
 }
开发者ID:cemoulto,项目名称:wordpress,代码行数:19,代码来源:EmbeddedTweetVideo.php

示例15: pp_login_shortcode_shortcake

function pp_login_shortcode_shortcake()
{
    if (!function_exists('shortcode_ui_register_for_shortcode')) {
        return;
    }
    shortcode_ui_register_for_shortcode('login-username', array('label' => 'Login form: Username field', 'listItemImage' => 'dashicons-admin-users', 'attrs' => array(array('label' => 'CSS class', 'attr' => 'class', 'type' => 'text', 'description' => 'CSS class for the field.'), array('label' => 'CSS ID', 'attr' => 'id', 'type' => 'text', 'description' => 'CSS id for the field.'), array('label' => 'Title', 'attr' => 'title', 'type' => 'text', 'description' => 'Title attribute for the input field.'), array('label' => 'Placeholder', 'attr' => 'placeholder', 'type' => 'text', 'description' => 'Placeholder attribute for the input field.'), array('label' => 'Value', 'attr' => 'value', 'type' => 'text', 'description' => 'Value attribute (default field text).'))));
    shortcode_ui_register_for_shortcode('login-password', array('label' => 'Login form: Password field', 'listItemImage' => 'dashicons-no-alt', 'attrs' => array(array('label' => 'CSS class', 'attr' => 'class', 'type' => 'text', 'description' => 'CSS class for the field.'), array('label' => 'CSS ID', 'attr' => 'id', 'type' => 'text', 'description' => 'CSS id for the field.'), array('label' => 'Title', 'attr' => 'title', 'type' => 'text', 'description' => 'Title attribute for the input field.'), array('label' => 'Placeholder', 'attr' => 'placeholder', 'type' => 'text', 'description' => 'Placeholder attribute for the input field.'), array('label' => 'Value', 'attr' => 'value', 'type' => 'text', 'description' => 'Value attribute (default field text).'))));
    shortcode_ui_register_for_shortcode('login-remember', array('label' => 'Login form: Remember Login Checkbox', 'listItemImage' => 'dashicons-editor-removeformatting', 'attrs' => array(array('label' => 'CSS class', 'attr' => 'class', 'type' => 'text', 'description' => 'CSS class for the field.'), array('label' => 'CSS ID', 'attr' => 'id', 'type' => 'text', 'description' => 'CSS id for the field.'), array('label' => 'Title', 'attr' => 'title', 'type' => 'text', 'description' => 'Title attribute for the input field.'))));
    shortcode_ui_register_for_shortcode('login-submit', array('label' => 'Login form: Submit Button', 'listItemImage' => 'dashicons-cart', 'attrs' => array(array('label' => 'CSS class', 'attr' => 'class', 'type' => 'text', 'description' => 'CSS class for the field.'), array('label' => 'CSS ID', 'attr' => 'id', 'type' => 'text', 'description' => 'CSS id for the field.'), array('label' => 'Title', 'attr' => 'title', 'type' => 'text', 'description' => 'Title attribute for the input field.'), array('label' => 'Value', 'attr' => 'value', 'type' => 'text', 'description' => 'Submit button text.'))));
}
开发者ID:bangjojo,项目名称:wp,代码行数:10,代码来源:shortcake.php


注:本文中的shortcode_ui_register_for_shortcode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。