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


PHP is_embed函数代码示例

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


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

示例1: is_embedded_product

 /**
  * Check if this is an embedded product - to make sure we don't mess up regular posts.
  *
  * @since 2.4.11
  * @return bool
  */
 public static function is_embedded_product()
 {
     if (function_exists('is_embed') && is_embed() && is_product()) {
         return true;
     }
     return false;
 }
开发者ID:CannedHead,项目名称:feelingsurf,代码行数:13,代码来源:class-wc-embed.php

示例2: remove_embed_title

 /**
  * Remove the title from the Status Update oembed.
  *
  * @param string $title Post title.
  * @param int    $id Post ID.
  *
  * @return string
  */
 public function remove_embed_title($title, $id)
 {
     $post = get_post($id);
     if (is_embed() && 'sp_status_update' === $post->post_type) {
         return '';
     }
     return $title;
 }
开发者ID:mAAdhaTTah,项目名称:sp-status-update,代码行数:16,代码来源:sp-status-update.php

示例3: is_embed

 /**
  * Add our own method is_embed to check by WordPress Version and function is_embed
  * to prevent fatal errors in WordPress 4.3 and earlier
  *
  * @version 4.2.1
  */
 public static function is_embed()
 {
     global $wp_version;
     if (version_compare($wp_version, '4.4', '<') || !function_exists('is_embed')) {
         return false;
     }
     return is_embed();
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:14,代码来源:Templates.php

示例4: template_loader

 /**
  * Load a template.
  *
  * Handles template usage so that we can use our own templates instead of the themes.
  *
  * Templates are in the 'templates' folder. woocommerce looks for theme.
  * overrides in /theme/woocommerce/ by default.
  *
  * For beginners, it also looks for a woocommerce.php template first. If the user adds.
  * this to the theme (containing a woocommerce() inside) this will be used for all.
  * woocommerce templates.
  *
  * @param mixed $template
  * @return string
  */
 public static function template_loader($template)
 {
     if (is_embed()) {
         return $template;
     }
     if ($default_file = self::get_template_loader_default_file()) {
         /**
          * Filter hook to choose which files to find before WooCommerce does it's own logic.
          *
          * @since 2.7.0
          * @var array
          */
         $search_files = self::get_template_loader_files($default_file);
         $template = locate_template($search_files);
         if (!$template || WC_TEMPLATE_DEBUG_MODE) {
             $template = WC()->plugin_path() . '/templates/' . $default_file;
         }
     }
     return $template;
 }
开发者ID:shivapoudel,项目名称:woocommerce,代码行数:35,代码来源:class-wc-template-loader.php

示例5: template_loader

 /**
  * Load a template.
  *
  * Handles template usage so that we can use our own templates instead of the themes.
  *
  * Templates are in the 'templates' folder. woocommerce looks for theme.
  * overrides in /theme/woocommerce/ by default.
  *
  * For beginners, it also looks for a woocommerce.php template first. If the user adds.
  * this to the theme (containing a woocommerce() inside) this will be used for all.
  * woocommerce templates.
  *
  * @param mixed $template
  * @return string
  */
 public static function template_loader($template)
 {
     $find = array('woocommerce.php');
     $file = '';
     if (is_embed()) {
         return $template;
     }
     if (is_single() && get_post_type() == 'product') {
         $file = 'single-product.php';
         $find[] = $file;
         $find[] = WC()->template_path() . $file;
     } elseif (is_product_taxonomy()) {
         $term = get_queried_object();
         if (is_tax('product_cat') || is_tax('product_tag')) {
             $file = 'taxonomy-' . $term->taxonomy . '.php';
         } else {
             $file = 'archive-product.php';
         }
         $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
         $find[] = WC()->template_path() . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
         $find[] = 'taxonomy-' . $term->taxonomy . '.php';
         $find[] = WC()->template_path() . 'taxonomy-' . $term->taxonomy . '.php';
         $find[] = $file;
         $find[] = WC()->template_path() . $file;
     } elseif (is_post_type_archive('product') || is_page(wc_get_page_id('shop'))) {
         $file = 'archive-product.php';
         $find[] = $file;
         $find[] = WC()->template_path() . $file;
     }
     if ($file) {
         $template = locate_template(array_unique($find));
         if (!$template || WC_TEMPLATE_DEBUG_MODE) {
             $template = WC()->plugin_path() . '/templates/' . $file;
         }
     }
     return $template;
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:52,代码来源:class-wc-template-loader.php

示例6: is_admin_bar_showing

function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST')) {
        return false;
    }
    if (is_embed()) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' == $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}
开发者ID:AppItNetwork,项目名称:yii2-wordpress-themes,代码行数:24,代码来源:admin-bar.php

示例7: do_action

// Process feeds and trackbacks even if not using themes.
if (is_robots()) {
    /**
     * Fired when the template loader determines a robots.txt request.
     *
     * @since 2.1.0
     */
    do_action('do_robots');
    return;
} elseif (is_feed()) {
    do_feed();
    return;
} elseif (is_trackback()) {
    include ABSPATH . 'wp-trackback.php';
    return;
} elseif (is_embed()) {
    $template = ABSPATH . WPINC . '/embed-template.php';
    /**
     * Filter the template used for embedded posts.
     *
     * @since 4.4.0
     *
     * @param string $template Path to the template file.
     */
    $template = apply_filters('embed_template', $template);
    include $template;
    return;
}
if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
    $template = false;
    if (is_404() && ($template = get_404_template())) {
开发者ID:muratgoktuna,项目名称:WordPress,代码行数:31,代码来源:template-loader.php

示例8: is_admin_bar_showing

/**
 * Determine whether the admin bar should be showing.
 *
 * @since 3.1.0
 *
 * @global bool   $show_admin_bar
 * @global string $pagenow
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST')) {
        return false;
    }
    if (is_embed()) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' == $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    /**
     * Filters whether to show the admin bar.
     *
     * Returning false to this hook is the recommended way to hide the admin bar.
     * The user's display preference is used for logged in users.
     *
     * @since 3.1.0
     *
     * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     */
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}
开发者ID:Garth619,项目名称:Femi9,代码行数:44,代码来源:admin-bar.php

示例9: wp_oembed_disable_admin_bar

/**
 * Disable the admin bar in the embed template.
 */
function wp_oembed_disable_admin_bar()
{
    if (is_embed()) {
        add_filter('show_admin_bar', '__return_false', 9999);
    }
}
开发者ID:hinaloe,项目名称:oEmbed-API,代码行数:9,代码来源:functions.php

示例10: test_is_embed_404

 function test_is_embed_404()
 {
     $this->go_to(home_url('/?p=12345&embed=true'));
     $this->assertTrue(is_embed());
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:5,代码来源:template.php

示例11: test_is_embed

 /**
  * Test is_embed.
  */
 function test_is_embed()
 {
     $this->assertFalse(is_embed());
     $post_id = $this->factory->post->create();
     $this->go_to(get_post_embed_url($post_id));
     $this->assertTrue(is_embed());
     $file = DIR_TESTDATA . '/images/canola.jpg';
     $attachment_id = $this->factory->attachment->create_object($file, $post_id, array('post_mime_type' => 'image/jpeg'));
     $this->go_to(get_post_embed_url($attachment_id));
     $this->assertTrue(is_embed());
     $this->go_to(home_url('/?p=123&embed=true'));
     $this->assertTrue(is_embed());
 }
开发者ID:hinaloe,项目名称:oEmbed-API,代码行数:16,代码来源:test-plugin.php

示例12: wp_embed_excerpt_more

/**
 * Filters the string in the "more" link displayed after a trimmed excerpt.
 *
 * @since 4.4.0
 *
 * @param string $more_string The string shown within the more link.
 * @return string The modified excerpt.
 */
function wp_embed_excerpt_more($more_string)
{
    if (!is_embed()) {
        return $more_string;
    }
    return sprintf(_x('&hellip; %s', 'read more link'), sprintf('<a class="wp-embed-more" href="%s" target="_top">%s</a>', get_the_permalink(), __('Read more')));
}
开发者ID:ahmadawais,项目名称:wpdev,代码行数:15,代码来源:embed-functions.php

示例13: do_action

     * Fired when the template loader determines a robots.txt request.
     *
     * @since 2.1.0
     */
    do_action('do_robots');
    return;
} elseif (is_feed()) {
    do_feed();
    return;
} elseif (is_trackback()) {
    include ABSPATH . 'wp-trackback.php';
    return;
}
if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
    $template = false;
    if (is_embed() && ($template = get_embed_template())) {
    } elseif (is_404() && ($template = get_404_template())) {
    } elseif (is_search() && ($template = get_search_template())) {
    } elseif (is_front_page() && ($template = get_front_page_template())) {
    } elseif (is_home() && ($template = get_home_template())) {
    } elseif (is_post_type_archive() && ($template = get_post_type_archive_template())) {
    } elseif (is_tax() && ($template = get_taxonomy_template())) {
    } elseif (is_attachment() && ($template = get_attachment_template())) {
        remove_filter('the_content', 'prepend_attachment');
    } elseif (is_single() && ($template = get_single_template())) {
    } elseif (is_page() && ($template = get_page_template())) {
    } elseif (is_singular() && ($template = get_singular_template())) {
    } elseif (is_category() && ($template = get_category_template())) {
    } elseif (is_tag() && ($template = get_tag_template())) {
    } elseif (is_author() && ($template = get_author_template())) {
    } elseif (is_date() && ($template = get_date_template())) {
开发者ID:skinnard,项目名称:FTL-2,代码行数:31,代码来源:template-loader.php

示例14: doing_show_in

 /**
  * Create content.
  *
  * @param string $content Post content.
  * @param string $post    \WP_Query.
  *
  * @return string
  */
 public function doing_show_in($content = '', $post = null)
 {
     $options = Options::get('all');
     $show_in = $options['post_types'];
     $raw = apply_filters(VA_SOCIALBUZZ_PREFIX . 'raw_the_content', $content);
     $content = apply_filters(VA_SOCIALBUZZ_PREFIX . 'create_the_content', $content, $raw);
     $conditions = !(is_embed() || is_feed() || is_front_page() || is_home()) && is_singular() && in_the_loop() && isset($show_in) && in_array(get_post_type(), $show_in);
     $conditions = apply_filters(VA_SOCIALBUZZ_PREFIX . 'show_in_conditions', $conditions, $post->ID);
     if ($conditions) {
         // Recommend you don't use this short code registering your own post data.
         $content .= do_shortcode('[socialbuzz box="select"]');
     }
     return $content;
 }
开发者ID:visualive,项目名称:va-social-buzz,代码行数:22,代码来源:class-module-view.php

示例15: wp_old_slug_redirect

/**
 * Redirect old slugs to the correct permalink.
 *
 * Attempts to find the current slug from the past slugs.
 *
 * @since 2.1.0
 *
 * @global WP_Query   $wp_query   Global WP_Query instance.
 * @global wpdb       $wpdb       WordPress database abstraction object.
 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
 */
function wp_old_slug_redirect()
{
    global $wp_query, $wp_rewrite;
    if (get_queried_object()) {
        return;
    }
    if ('' !== $wp_query->query_vars['name']) {
        global $wpdb;
        // Guess the current post_type based on the query vars.
        if (get_query_var('post_type')) {
            $post_type = get_query_var('post_type');
        } elseif (get_query_var('attachment')) {
            $post_type = 'attachment';
        } elseif (!empty($wp_query->query_vars['pagename'])) {
            $post_type = 'page';
        } else {
            $post_type = 'post';
        }
        if (is_array($post_type)) {
            if (count($post_type) > 1) {
                return;
            }
            $post_type = reset($post_type);
        }
        // Do not attempt redirect for hierarchical post types
        if (is_post_type_hierarchical($post_type)) {
            return;
        }
        $query = $wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta}, {$wpdb->posts} WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, $wp_query->query_vars['name']);
        // if year, monthnum, or day have been specified, make our query more precise
        // just in case there are multiple identical _wp_old_slug values
        if ('' != $wp_query->query_vars['year']) {
            $query .= $wpdb->prepare(" AND YEAR(post_date) = %d", $wp_query->query_vars['year']);
        }
        if ('' != $wp_query->query_vars['monthnum']) {
            $query .= $wpdb->prepare(" AND MONTH(post_date) = %d", $wp_query->query_vars['monthnum']);
        }
        if ('' != $wp_query->query_vars['day']) {
            $query .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", $wp_query->query_vars['day']);
        }
        $id = (int) $wpdb->get_var($query);
        if (!$id) {
            return;
        }
        $link = get_permalink($id);
        if (is_feed()) {
            $link = user_trailingslashit(trailingslashit($link) . 'feed');
        } elseif (isset($GLOBALS['wp_query']->query_vars['paged']) && $GLOBALS['wp_query']->query_vars['paged'] > 1) {
            $link = user_trailingslashit(trailingslashit($link) . 'page/' . $GLOBALS['wp_query']->query_vars['paged']);
        } elseif (is_embed()) {
            $link = user_trailingslashit(trailingslashit($link) . 'embed');
        } elseif (is_404()) {
            // Add rewrite endpoints if necessary.
            foreach ($wp_rewrite->endpoints as $endpoint) {
                if ($endpoint[2] && false !== get_query_var($endpoint[2], false)) {
                    $link = user_trailingslashit(trailingslashit($link) . $endpoint[1]);
                }
            }
        }
        /**
         * Filter the old slug redirect URL.
         *
         * @since 4.4.0
         *
         * @param string $link The redirect URL.
         */
        $link = apply_filters('old_slug_redirect_url', $link);
        if (!$link) {
            return;
        }
        wp_redirect($link, 301);
        // Permanent redirect
        exit;
    }
}
开发者ID:7press,项目名称:7press,代码行数:86,代码来源:query.php


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