• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP shortcode_exists函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: add

 /**
  * Registers the shortcode hook.
  *
  * @uses \add_shortcode()
  * @uses \shortcode_exists()
  */
 public final function add()
 {
     if (\shortcode_exists($this->tag)) {
         throw new \Exception("Shortcode `{$this->tag}` exists.");
     }
     \add_shortcode($this->tag, array($this, 'output'));
 }
开发者ID:goblindegook,项目名称:shorthand,代码行数:13,代码来源:Shortcode.php


示例2: debug_bar_shortcodes_do_ajax

 /**
  * Verify validity of ajax request and pass it to the internal handler
  */
 function debug_bar_shortcodes_do_ajax()
 {
     // Verify this is a valid ajax request
     if (wp_verify_nonce($_POST['dbs-nonce'], 'debug-bar-shortcodes') === false) {
         exit('-1');
     }
     // Verify we have received the data needed to do anything
     if (!isset($_POST['shortcode']) || $_POST['shortcode'] === '') {
         exit('-1');
     }
     include_once plugin_dir_path(__FILE__) . 'class-debug-bar-shortcodes-info.php';
     $info = new Debug_Bar_Shortcodes_Info();
     $shortcode = $_POST['shortcode'];
     $shortcode = trim($shortcode);
     // Exit early if this is a non-existent shortcode - shouldn't happen, but hack knows ;-)
     if (shortcode_exists($shortcode) === false) {
         $response = array('id' => 0, 'data' => '');
         $info->send_ajax_response($response);
         exit;
     }
     // Send the request to our handler
     switch ($_POST['action']) {
         case 'debug-bar-shortcodes-find':
             $info->ajax_find_shortcode_uses($shortcode);
             break;
         case 'debug-bar-shortcodes-retrieve':
             $info->ajax_retrieve_details($shortcode);
             break;
     }
     /* No valid action received (redundancy, can't really happen as wp wouldn't then call this
        function, but would return 0 and exit already */
     exit('-1');
 }
开发者ID:proj-2014,项目名称:vlan247-test-wp2,代码行数:36,代码来源:debug-bar-shortcodes.php


示例3: cases_display_todo_comments

function cases_display_todo_comments()
{
    if (!is_singular('cases')) {
        return;
    }
    if (!shortcode_exists('cp_todo_comments')) {
        return;
    }
    global $post;
    $args = array('post_id' => $post->ID, 'meta_query' => array(array('key' => 'cp_control', 'value' => 'yes')), 'meta_key' => 'cp_control_order', 'orderby' => 'meta_value_num', 'order' => 'ASC');
    $comments_query = new WP_Comment_Query();
    $comments = $comments_query->query($args);
    if (empty($comments)) {
        return;
    }
    ?>
	<section id="case_todo_comments_wrapper" class="cases-box">
		<header class="cases-box-header">
			<h1>Комментарии на контроле</h1>
			<hr>
		</header>
		<article class="cases-box-content">
			<?php 
    echo do_shortcode('[cp_todo_comments]');
    ?>
		</article>
	</section>
<?php 
}
开发者ID:Laxiston,项目名称:casepress,代码行数:29,代码来源:todo-comments-integrate-cp.php


示例4: find_ids

 /**
  * Search a string for ingot shortcodes and return ids used
  *
  * @since 1.1.0
  *
  * @param string $content String to search
  *
  * @return array Array of group IDs
  */
 public static function find_ids($content)
 {
     $ids = [];
     $tag = 'ingot';
     if (!has_shortcode($content, $tag) || false === strpos($content, '[')) {
         return $ids;
     }
     if (shortcode_exists($tag)) {
         preg_match_all('/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER);
         if (empty($matches)) {
             return $ids;
         }
         foreach ($matches as $shortcode) {
             if ($tag === $shortcode[2] && isset($shortcode[3])) {
                 $_id = self::find_id($shortcode);
                 if (is_numeric($_id)) {
                     $ids[] = $_id;
                 }
             } elseif (!empty($shortcode[5]) && has_shortcode($shortcode[5], $tag)) {
                 $_id = self::find_id($shortcode);
                 if (is_numeric($_id)) {
                     $ids[] = $_id;
                 }
             }
         }
     }
     return $ids;
 }
开发者ID:rene-hermenau,项目名称:ingot,代码行数:37,代码来源:posts.php


示例5: register_shortcode

 public static function register_shortcode()
 {
     // backward compatible, but only load if no other plugin has registered this shortcode
     if (!shortcode_exists('podlove-subscribe-button')) {
         add_shortcode('podlove-subscribe-button', [__CLASS__, 'button']);
     }
     add_shortcode('podlove-podcast-subscribe-button', [__CLASS__, 'button']);
 }
开发者ID:johannes-mueller,项目名称:podlove-publisher,代码行数:8,代码来源:subscribe_button.php


示例6: __construct

 public function __construct()
 {
     add_shortcode('ultimate-recipe', array($this, 'recipe_shortcode'));
     // Fallback after importing
     if (!shortcode_exists('cooked-recipe')) {
         add_shortcode('cooked-recipe', array($this, 'recipe_shortcode'));
     }
 }
开发者ID:robertoperata,项目名称:bbqverona.com,代码行数:8,代码来源:recipe_shortcode.php


示例7: __construct

 public function __construct($settings)
 {
     $this->settings = $settings;
     $this->shortcode = $this->settings['base'];
     $this->addAction('admin_init', 'enqueueAssets');
     if ($this->isAdmin() || !shortcode_exists($this->shortcode)) {
         $this->addShortCode($this->shortcode, array($this, 'output'));
     }
 }
开发者ID:trantuanvn,项目名称:coffeeletsgo,代码行数:9,代码来源:shortcodes.php


示例8: __construct

 public function __construct($settings)
 {
     $settings = wp_parse_args($settings, array('id' => '', 'title' => __('Element Title', 'detheme_builder'), 'icon' => 'dashicons-admin-page', 'options' => array()));
     $this->settings = $settings;
     $this->shortcode = $this->settings['id'];
     if (!shortcode_exists($this->shortcode)) {
         add_shortcode($this->shortcode, array($this, 'output'));
     }
 }
开发者ID:estrategasdigitales,项目名称:lactibox,代码行数:9,代码来源:class-elements.php


示例9: next_saturday_audio_script

/**
 * Audio helper script.
 *
 * If an audio shortcode exists we will enqueue javascript
 * that replaces all non-supported audio player instances
 * with text links.
 *
 * @uses shortcode_exists();
 */
function next_saturday_audio_script()
{
    if (shortcode_exists('audio')) {
        return;
    }
    if (!is_singular() || has_post_format('audio')) {
        wp_enqueue_script('next-saturday-audio', get_template_directory_uri() . '/js/audio.js', array(), '20130521');
    }
}
开发者ID:darrylivan,项目名称:caraccidentlawyerflagstaff.com,代码行数:18,代码来源:functions.php


示例10: register_shortcodes

 protected function register_shortcodes()
 {
     $this->shortcodes = array('wpqt-icon' => array('function' => 'the_custom_icon', 'description' => __('Rendering the custom icons', $this->domain_name), 'since' => '1.0.0'), 'wpqt-permalink' => array('function' => 'get_qiita_link', 'description' => __('Rendering the Qiita side permalink of specified post', $this->domain_name), 'since' => '1.0.0'), 'wpqt-post-stocks' => array('function' => 'get_post_stocks', 'description' => __('Rendering the number of stock of the specified post', $this->domain_name), 'since' => '1.0.0'));
     foreach ($this->shortcodes as $shortcode_name => $shortcode_atts) {
         if (false === shortcode_exists($shortcode_name)) {
             add_shortcode($shortcode_name, array($this, $shortcode_atts['function']));
         }
     }
 }
开发者ID:ka215,项目名称:wp-qiita,代码行数:9,代码来源:shortcodes.php


示例11: maybe_register_cpt

 /**
  * Registers the custom post types and adds action/filter handlers, but
  * only if the site supports it
  */
 function maybe_register_cpt()
 {
     // Add an option to enable the CPT
     add_action('admin_init', array($this, 'settings_api_init'));
     // Check on theme switch if theme supports CPT and setting is disabled
     add_action('after_switch_theme', array($this, 'activation_post_type_support'));
     $setting = get_option(self::OPTION_NAME, '0');
     // Bail early if Testimonial option is not set and the theme doesn't declare support
     if (empty($setting) && !$this->site_supports_custom_post_type()) {
         return;
     }
     // Enable Omnisearch for CPT.
     if (class_exists('Jetpack_Omnisearch_Posts')) {
         new Jetpack_Omnisearch_Posts(self::CUSTOM_POST_TYPE);
     }
     // CPT magic
     $this->register_post_types();
     add_action(sprintf('add_option_%s', self::OPTION_NAME), array($this, 'flush_rules_on_enable'), 10);
     add_action(sprintf('update_option_%s', self::OPTION_NAME), array($this, 'flush_rules_on_enable'), 10);
     add_action(sprintf('publish_%s', self::CUSTOM_POST_TYPE), array($this, 'flush_rules_on_first_testimonial'));
     add_action('after_switch_theme', array($this, 'flush_rules_on_switch'));
     // Admin Customization
     add_filter('enter_title_here', array($this, 'change_default_title'));
     add_filter(sprintf('manage_%s_posts_columns', self::CUSTOM_POST_TYPE), array($this, 'edit_title_column_label'));
     add_filter('post_updated_messages', array($this, 'updated_messages'));
     add_action('customize_register', array($this, 'customize_register'));
     // Only add the 'Customize' sub-menu if the theme supports it.
     $num_testimonials = self::count_testimonials();
     if (!empty($num_testimonials) && current_theme_supports(self::CUSTOM_POST_TYPE)) {
         add_action('admin_menu', array($this, 'add_customize_page'));
     }
     if (defined('IS_WPCOM') && IS_WPCOM) {
         // Track all the things
         add_action(sprintf('add_option_%s', self::OPTION_NAME), array($this, 'new_activation_stat_bump'));
         add_action(sprintf('update_option_%s', self::OPTION_NAME), array($this, 'update_option_stat_bump'), 11, 2);
         add_action(sprintf('publish_%s', self::CUSTOM_POST_TYPE), array($this, 'new_testimonial_stat_bump'));
         // Add to Dotcom XML sitemaps
         add_filter('wpcom_sitemap_post_types', array($this, 'add_to_sitemap'));
     } else {
         // Add to Jetpack XML sitemap
         add_filter('jetpack_sitemap_post_types', array($this, 'add_to_sitemap'));
     }
     // Adjust CPT archive and custom taxonomies to obey CPT reading setting
     add_filter('pre_get_posts', array($this, 'query_reading_setting'), 20);
     add_filter('infinite_scroll_settings', array($this, 'infinite_scroll_click_posts_per_page'));
     // Register [jetpack_testimonials] always and
     // register [testimonials] if [testimonials] isn't already set
     add_shortcode('jetpack_testimonials', array($this, 'jetpack_testimonial_shortcode'));
     if (!shortcode_exists('testimonials')) {
         add_shortcode('testimonials', array($this, 'jetpack_testimonial_shortcode'));
     }
     // If CPT was enabled programatically and no CPT items exist when user switches away, disable
     if ($setting && $this->site_supports_custom_post_type()) {
         add_action('switch_theme', array($this, 'deactivation_post_type_support'));
     }
 }
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:60,代码来源:testimonial.php


示例12: __construct

 function __construct()
 {
     parent::__construct(array('name' => __('Slider', 'themify'), 'slug' => 'slider'));
     ///////////////////////////////////////
     // Load Post Type
     ///////////////////////////////////////
     $this->meta_box = $this->set_metabox();
     $this->initialize_cpt(array('plural' => __('Slides', 'themify'), 'singular' => __('Slide', 'themify'), 'supports' => array('title', 'editor', 'author', 'custom-fields'), 'menu_icon' => 'dashicons-slides'));
     if (!shortcode_exists('themify_' . $this->slug . '_posts')) {
         add_shortcode('themify_' . $this->slug . '_posts', array($this, 'do_shortcode'));
     }
 }
开发者ID:byronmisiva,项目名称:mrkpln-dev,代码行数:12,代码来源:module-slider.php


示例13: init

 function init()
 {
     if (shortcode_exists('featured_products')) {
         remove_shortcode('featured_products');
     }
     if (shortcode_exists('recent_products')) {
         remove_shortcode('recent_products');
     }
     add_shortcode('featured_products', 'bs_featured_products');
     add_shortcode('recent_products', 'bs_recent_products');
     add_action('wp_enqueue_scripts', array(&$this, 'woocommerce_twitterbootstrap_setstylesheets'), 99);
     add_action('shop_loop', array($this, 'bs_shop_loop'), 99);
     add_action('woocommerce_before_single_product_summary', array(&$this, 'woocommerce_before_single_product_summary_bs'), 1);
     add_action('woocommerce_before_single_product_summary', array(&$this, 'woocommerce_before_single_product_summary_bs_end'), 100);
     add_action('woocommerce_after_single_product_summary', array(&$this, 'woocommerce_after_single_product_summary_bs'), 1);
     /* thumbnails */
     add_action('bs_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10);
     add_action('bs_before_shop_loop_item_title', array(&$this, 'bs_get_product_thumbnail'), 10, 3);
     add_action('woocommerce_after_shop_loop', array(&$this, 'endsetupgrid'), 1);
     add_action('woocommerce_before_shop_loop', array(&$this, 'setupgrid'), 999);
     /* the grid display */
     /*
     |  	columns		| mobile 	| tablet 	| desktop	|per page 	|
     ----------------------------------------------------|-----------|
     |		1		|	1		|	1		|	1		| 	10		|
     |---------------------------------------------------|-----------|
     |		2		|	1		|	2		|	2		|	10		|
     |---------------------------------------------------|-----------|
     |		3		|	1		|	1		|	3		|	 9		|
     |---------------------------------------------------|-----------|
     |		3(1)	|	1		|	2		|	3		|	12		|
     |---------------------------------------------------|-----------|
     |		4		|	1		|	2		|	4		|	12		|
     |---------------------------------------------------|-----------|
     |		5		|	n/a		|	n/a		|	n/a		|	n/a	    |
     |---------------------------------------------------|-----------|
     |		6		|	2		|	4		|	6		|	12		|
     |---------------------------------------------------|-----------|
     |		>=6		|	n/a		|	n/a		|	n/a		|	n/a		|
     |---------------------------------------------------------------|
     */
     // Store column count for displaying the grid
     global $woocommerce_loop;
     if (empty($woocommerce_loop['columns'])) {
         $woocommerce_loop['columns'] = get_option('number_of_columns', 4);
     }
     if ($woocommerce_loop['columns'] == 3) {
         add_filter('loop_shop_per_page', create_function('$cols', 'return 9;'), 10);
     } elseif ($woocommerce_loop['columns'] > 2) {
         add_filter('loop_shop_per_page', create_function('$cols', 'return 12;'), 10);
     }
     define('WooCommerce_Twitter_Bootstrap_grid_classes', $this->get_grid_classes($woocommerce_loop));
 }
开发者ID:buskerone,项目名称:woocommerce-twitterbootstrap,代码行数:53,代码来源:woocommerce-twitterbootstrap.php


示例14: __construct

 function __construct()
 {
     parent::__construct(array('name' => __('Testimonial', 'themify'), 'slug' => 'testimonial'));
     ///////////////////////////////////////
     // Load Post Type
     ///////////////////////////////////////
     $this->meta_box = $this->set_metabox();
     $this->initialize_cpt(array('plural' => __('Testimonials', 'themify'), 'singular' => __('Testimonial', 'themify'), 'menu_icon' => 'dashicons-testimonial'));
     if (!shortcode_exists('themify_' . $this->slug . '_posts')) {
         add_shortcode('themify_' . $this->slug . '_posts', array($this, 'do_shortcode'));
     }
 }
开发者ID:byronmisiva,项目名称:mrkpln-dev,代码行数:12,代码来源:module-testimonial.php


示例15: __construct

 function __construct()
 {
     parent::__construct(array('name' => __('Highlight', 'themify'), 'slug' => 'highlight'));
     ///////////////////////////////////////
     // Load Post Type
     ///////////////////////////////////////
     $this->meta_box = $this->set_metabox();
     $this->initialize_cpt(array('plural' => __('Highlights', 'themify'), 'singular' => __('Highlight', 'themify'), 'menu_icon' => 'dashicons-welcome-write-blog'));
     if (!shortcode_exists('themify_highlight_posts')) {
         add_shortcode('themify_highlight_posts', array($this, 'do_shortcode'));
     }
 }
开发者ID:rgrasiano,项目名称:viabasica-hering,代码行数:12,代码来源:module-highlight.php


示例16: popmake_emodal_init

function popmake_emodal_init()
{
    global $popmake_options;
    if (isset($popmake_options['enable_easy_modal_compatibility_mode'])) {
        if (!shortcode_exists('modal')) {
            add_shortcode('modal', 'popmake_emodal_shortcode_modal');
        }
        add_filter('popmake_get_the_popup_data_attr', 'popmake_emodal_get_the_popup_data_attr', 10, 2);
        add_filter('popmake_shortcode_popup_default_atts', 'popmake_emodal_shortcode_popup_default_atts', 10, 2);
        add_filter('popmake_shortcode_data_attr', 'popmake_emodal_shortcode_data_attr', 10, 2);
        add_filter('popmake_popup_is_loadable', 'popmake_emodal_popup_is_loadable', 20, 2);
    }
}
开发者ID:webprese,项目名称:dev.mgeonline,代码行数:13,代码来源:easy-modal-v2.php


示例17: ods_shortcode

/**
 * Create the excerpt shortcode
 *
 * @param $ods_shortcode
 */
function ods_shortcode($ods_shortcode)
{
    if (shortcode_exists($ods_shortcode)) {
        $pattern = get_shortcode_regex();
        preg_match('/' . $pattern . '/s', get_the_content(), $matches);
        if (!empty($matches)) {
            if (is_array($matches) && $matches[2] == $ods_shortcode) {
                $shortcode = $matches[0];
                echo do_shortcode($shortcode);
            }
        }
    }
}
开发者ID:kding0409,项目名称:kding0409.github.io,代码行数:18,代码来源:ods_functions.php


示例18: setup_slider_cpt

 public function setup_slider_cpt()
 {
     global $ThemifyBuilder;
     if ($ThemifyBuilder->is_cpt_active('slider')) {
         ///////////////////////////////////////
         // Load Post Type
         ///////////////////////////////////////
         $this->meta_box = $this->set_metabox();
         $this->initialize_cpt(array('plural' => __('Slides', 'themify'), 'singular' => __('Slide', 'themify'), 'supports' => array('title', 'editor', 'author', 'custom-fields'), 'menu_icon' => 'dashicons-slides'));
         if (!shortcode_exists('themify_' . $this->slug . '_posts')) {
             add_shortcode('themify_' . $this->slug . '_posts', array($this, 'do_shortcode'));
         }
     }
 }
开发者ID:tchataigner,项目名称:palette,代码行数:14,代码来源:module-slider.php


示例19: __construct

 /**
  * __construct
  */
 function __construct()
 {
     // actions
     add_action('admin_init', array(&$this, 'tinymce_button'));
     foreach (array('post.php', 'post-new.php') as $hook) {
         add_action("admin_head-{$hook}", array(&$this, 'admin_head'));
     }
     add_action('wp_ajax_styled_button_preview', array(&$this, 'preview'));
     add_action('wp_enqueue_scripts', array(&$this, 'enqueue_style'));
     // shortcodes
     if (!shortcode_exists($this->shortcode)) {
         add_shortcode($this->shortcode, array(&$this, 'button_shortcode'));
     }
 }
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:17,代码来源:init.php


示例20: __construct

 function __construct()
 {
     parent::__construct(array('name' => __('Portfolio', 'themify'), 'slug' => 'portfolio'));
     ///////////////////////////////////////
     // Load Post Type
     ///////////////////////////////////////
     include_once ABSPATH . 'wp-admin/includes/plugin.php';
     if (!is_plugin_active('themify-portfolio-post/themify-portfolio-post.php')) {
         $this->meta_box = $this->set_metabox();
         $this->initialize_cpt(array('plural' => __('Portfolios', 'themify'), 'singular' => __('Portfolio', 'themify'), 'rewrite' => apply_filters('themify_portfolio_rewrite', 'project'), 'menu_icon' => 'dashicons-portfolio'));
         if (!shortcode_exists('themify_portfolio_posts')) {
             add_shortcode('themify_portfolio_posts', array($this, 'do_shortcode'));
         }
     }
 }
开发者ID:rgrasiano,项目名称:viabasica-hering,代码行数:15,代码来源:module-portfolio.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP shortcode_new_to_old_params函数代码示例发布时间:2022-05-24
下一篇:
PHP shortcode_atts函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap