本文整理汇总了PHP中is_feed函数的典型用法代码示例。如果您正苦于以下问题:PHP is_feed函数的具体用法?PHP is_feed怎么用?PHP is_feed使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_feed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bctt_shortcode
function bctt_shortcode($atts)
{
extract(shortcode_atts(array('tweet' => '', 'via' => 'yes', 'url' => 'yes'), $atts));
$handle = get_option('bctt-twitter-handle');
if (!empty($handle) && $via != 'no') {
$handle_code = "&via=" . $handle . "&related=" . $handle;
} else {
$handle_code = '';
}
$text = $tweet;
if ($url != 'no') {
if (get_option('bctt-short-url') != false) {
$bcttURL = '&url=' . wp_get_shortlink();
} else {
$bcttURL = '&url=' . get_permalink();
}
} else {
$bcttURL = '';
}
$bcttBttn = sprintf(__('Click To Tweet', 'better-click-to-tweet'));
$short = bctt_shorten($text, 117 - (6 + mb_strlen($handle)));
if (!is_feed()) {
return "<div class='bctt-click-to-tweet'><span class='bctt-ctt-text'><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . $bcttURL . "' target='_blank'>" . $short . "</a></span><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . "&url=" . $bcttURL . "' target='_blank' class='bctt-ctt-btn'>" . $bcttBttn . "</a></div>";
} else {
return "<hr /><p><em>" . $short . "</em><br /><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . $bcttURL . "' target='_blank' class='bctt-ctt-btn'>" . $bcttBttn . "</a><br /><hr />";
}
}
示例2: esteem_filter_wp_title
/**
* Modifying the Title
*
* Function tied to the wp_title filter hook.
* @uses filter wp_title
*/
function esteem_filter_wp_title($title)
{
global $page, $paged;
// Get the Site Name
$site_name = get_bloginfo('name');
// Get the Site Description
$site_description = get_bloginfo('description');
$filtered_title = '';
// For Homepage or Frontpage
if (is_home() || is_front_page()) {
$filtered_title .= $site_name;
if (!empty($site_description)) {
$filtered_title .= ' | ' . $site_description;
}
} elseif (is_feed()) {
$filtered_title = '';
} else {
$filtered_title = $title . $site_name;
}
// Add a page number if necessary:
if ($paged >= 2 || $page >= 2) {
$filtered_title .= ' | ' . sprintf(__('Page %s', 'esteem'), max($paged, $page));
}
// Return the modified title
return $filtered_title;
}
示例3: gallery_shortcode
public function gallery_shortcode($val, $atts)
{
if (!empty($val)) {
// something else is overriding post_gallery, like a custom VIP shortcode
return $val;
}
global $post;
$this->set_atts($atts);
$attachments = $this->get_attachments();
if (empty($attachments)) {
return '';
}
if (is_feed() || defined('IS_HTML_EMAIL')) {
return '';
}
if (method_exists($this, $this->atts['type'] . '_talavera')) {
// Enqueue styles and scripts
$this->default_scripts_and_styles();
$gallery_html = call_user_func_array(array($this, $this->atts['type'] . '_talavera'), array($attachments));
if ($gallery_html && class_exists('Jetpack') && class_exists('Jetpack_Photon')) {
// Tiled Galleries in Jetpack require that Photon be active.
// If it's not active, run it just on the gallery output.
if (!in_array('photon', Jetpack::get_active_modules())) {
$gallery_html = Jetpack_Photon::filter_the_content($gallery_html);
}
}
return $gallery_html;
}
return '';
}
示例4: jetpack_instagram_handler
function jetpack_instagram_handler($matches, $atts, $url)
{
global $content_width;
static $did_script;
// keep a copy of the passed-in URL since it's modified below
$passed_url = $url;
$max_width = 698;
$min_width = 320;
if (is_feed()) {
$media_url = sprintf('http://instagr.am/p/%s/media/?size=l', $matches[2]);
return sprintf('<a href="%s" title="%s"><img src="%s" alt="Instagram Photo" /></a>', esc_url($url), esc_attr__('View on Instagram', 'jetpack'), esc_url($media_url));
}
$atts = shortcode_atts(array('width' => isset($content_width) ? $content_width : $max_width, 'hidecaption' => false), $atts);
$atts['width'] = absint($atts['width']);
if ($atts['width'] > $max_width || $min_width > $atts['width']) {
$atts['width'] = $max_width;
}
// remove the modal param from the URL
$url = remove_query_arg('modal', $url);
// force .com instead of .am for https support
$url = str_replace('instagr.am', 'instagram.com', $url);
// The oembed endpoint expects HTTP, but HTTP requests 301 to HTTPS
$instagram_http_url = str_replace('https://', 'http://', $url);
$instagram_https_url = str_replace('http://', 'https://', $url);
$url_args = array('url' => $instagram_http_url, 'maxwidth' => $atts['width']);
if ($atts['hidecaption']) {
$url_args['hidecaption'] = 'true';
}
$url = esc_url_raw(add_query_arg($url_args, 'https://api.instagram.com/oembed/'));
// Don't use object caching here by default, but give themes ability to turn it on.
$response_body_use_cache = apply_filters('instagram_cache_oembed_api_response_body', false, $matches, $atts, $passed_url);
$response_body = false;
if ($response_body_use_cache) {
$cache_key = 'oembed_response_body_' . md5($url);
$response_body = wp_cache_get($cache_key, 'instagram_embeds');
}
if (!$response_body) {
// Not using cache (default case) or cache miss
$instagram_response = wp_remote_get($url, array('redirection' => 0));
if (is_wp_error($instagram_response) || 200 != $instagram_response['response']['code'] || empty($instagram_response['body'])) {
return "<!-- instagram error: invalid oratv resource -->";
}
$response_body = json_decode($instagram_response['body']);
if ($response_body_use_cache) {
// if caching it is short-lived since this is a "Cache-Control: no-cache" resource
wp_cache_set($cache_key, $response_body, 'instagram_embeds', HOUR_IN_SECONDS + mt_rand(0, HOUR_IN_SECONDS));
}
}
if (!empty($response_body->html)) {
if (!$did_script) {
$did_script = true;
add_action('wp_footer', 'jetpack_instagram_add_script');
}
// there's a script in the response, which we strip on purpose since it's added above
$ig_embed = preg_replace('@<(script)[^>]*?>.*?</\\1>@si', '', $response_body->html);
} else {
$ig_embed = jetpack_instagram_iframe_embed($instagram_https_url, $atts);
}
return $ig_embed;
}
示例5: rssMsg
function rssMsg($content)
{
if (is_feed()) {
$content = $content . '<hr /> *The SFMOMA blog feed has moved to a new location! <a href="http://feeds.feedburner.com/sfmoma/blog">http://feeds.feedburner.com/sfmoma/blog</a> Please update your feed readers and bookmarks.* <hr />';
}
return $content;
}
示例6: print_marker
/**
* Created early as possible in the wp_footer action this is the string to which we
* will move JS resources after
*/
function print_marker()
{
// is_feed() is important to not break Wordpress feeds and the WooCommerce api
if ($this->valid_request && !is_feed()) {
print $this->marker;
}
}
示例7: aa_login_users_only_shortcode
/**
*
* Only login users can read the text shortcode
* E.g. [member]This content is hiddent from users who are not logged in[/member]
*
*
* @package aa_basic_shortcodes
* @since 1.0.0
*/
function aa_login_users_only_shortcode($atts, $content = null)
{
if (is_user_logged_in() && !is_feed() && !is_null($content)) {
return $content;
}
return '';
}
示例8: add_content_watermark
function add_content_watermark($content)
{
if (is_feed()) {
return $content . ' Created by Amy Evans, copyright ' . date('Y') . ' all rights reserved.';
}
return $content;
}
示例9: get_content
/**
*/
public function get_content()
{
if (!is_null(parent::get_content()) && !is_feed() && current_user_can($this->get_att('capability'))) {
return parent::get_content();
}
return null;
}
示例10: themeist_books_add_after_post_content
function themeist_books_add_after_post_content($content)
{
if (!is_feed() && !is_home() && is_singular() && is_main_query()) {
$content .= themeist_books_get_details();
}
return $content;
}
示例11: shot_get_posts
function shot_get_posts($query)
{
if (is_home() || is_feed()) {
$query->set('post_type', array('post', 'link', 'attachment'));
}
return $query;
}
示例12: FeedburnerFilter
public function FeedburnerFilter()
{
// Check this is active
if (!$this->IsActive()) {
return false;
}
// Bounce Feed Burner
if (preg_match('/feedburner/i', $_SERVER['HTTP_USER_AGENT'])) {
return false;
}
// Do nothing if not a feed
if (!is_feed()) {
return false;
}
// Do nothing if not configured
if (empty($this->url)) {
return false;
}
if (empty($this->id) && !empty($this->url)) {
// Probably a Google Feedburner account
header('Location: http://feeds2.feedburner.com/' . $this->url);
} else {
header('Location: ' . $this->url);
}
die;
}
示例13: autoptimize_start_buffering
function autoptimize_start_buffering()
{
if (!is_feed()) {
// Config element
$conf = autoptimizeConfig::instance();
// Load our base class
include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeBase.php';
// Load extra classes and set some vars
if ($conf->get('autoptimize_html')) {
include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeHTML.php';
@(include WP_PLUGIN_DIR . '/autoptimize/classes/minify-html.php');
}
if ($conf->get('autoptimize_js')) {
include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeScripts.php';
@(include WP_PLUGIN_DIR . '/autoptimize/classes/jsmin-1.1.1.php');
define('CONCATENATE_SCRIPTS', false);
define('COMPRESS_SCRIPTS', false);
}
if ($conf->get('autoptimize_css')) {
include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeStyles.php';
@(include WP_PLUGIN_DIR . '/autoptimize/classes/minify-css-compressor.php');
define('COMPRESS_CSS', false);
}
if ($conf->get('autoptimize_js_yui') || $conf->get('autoptimize_css_yui')) {
include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeYUI.php';
}
if ($conf->get('autoptimize_cdn_js') || $conf->get('autoptimize_cdn_css')) {
include WP_PLUGIN_DIR . '/autoptimize/classes/autoptimizeCDN.php';
}
// Now, start the real thing!
ob_start('autoptimize_end_buffering');
}
}
示例14: sfsi_social_buttons_below
function sfsi_social_buttons_below($content)
{
global $post;
$sfsi_section6 = unserialize(get_option('sfsi_section6_options', false));
/* check if option activated in admin or not */
if ($sfsi_section6['sfsi_show_Onposts'] == "yes") {
$permalink = get_permalink($post->ID);
$title = get_the_title();
$sfsiLikeWith = "45px;";
/* check for counter display */
if ($sfsi_section6['sfsi_icons_DisplayCounts'] == "yes") {
$show_count = 1;
$sfsiLikeWith = "75px;";
} else {
$show_count = 0;
}
$txt = isset($sfsi_section6['sfsi_textBefor_icons']) ? $sfsi_section6['sfsi_textBefor_icons'] : "Share this Post with :";
$float = $sfsi_section6['sfsi_icons_alignment'];
$icons = "<div class='sfsi_Sicons' style='float:" . $float . "'><div style='float:left;margin:5px;'><span>" . $txt . "</span></div>";
//adding wrapper div
$icons .= "<div class='sfsi_socialwpr'>";
$icons .= "<div class='sf_fb' style='width:" . $sfsiLikeWith . "'>" . sfsi_FBlike($permalink, $show_count) . "</div>";
$icons .= "<div class='sf_google'>" . sfsi_googlePlus($permalink, $show_count) . "</div>";
$icons .= "<div class='sf_addthis'>" . sfsi_Addthis($show_count) . "</div>";
$icons .= "</div>";
//closing wrapper div
$icons .= "</div>";
if (!is_feed() && !is_home() && !is_page()) {
$content = $content . $icons;
}
}
return $content;
}
示例15: cleaner_caption
/**
* Cleans up the default WordPress [caption] shortcode. The main purpose of this function is to remove the
* inline styling WP adds, which creates 10px of padding around captioned elements.
*
* @since 0.1.0
* @access private
* @param string $output The output of the default caption (empty string at this point).
* @param array $attr Array of arguments for the [caption] shortcode.
* @param string $content The content placed after the opening [caption] tag and before the closing [/caption] tag.
* @return string $output The formatted HTML for the caption.
*/
function cleaner_caption($output, $attr, $content)
{
/* We're not worried abut captions in feeds, so just return the output here. */
if (is_feed()) {
return $output;
}
/* Set up the default arguments. */
$defaults = array('id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '');
/* Allow developers to override the default arguments. */
$defaults = apply_filters('cleaner_caption_defaults', $defaults);
/* Apply filters to the arguments. */
$attr = apply_filters('cleaner_caption_args', $attr);
/* Merge the defaults with user input. */
$attr = shortcode_atts($defaults, $attr);
/* If the width is less than 1 or there is no caption, return the content wrapped between the [caption] tags. */
if (1 > $attr['width'] || empty($attr['caption'])) {
return $content;
}
/* Set up the attributes for the caption <div>. */
$attributes = !empty($attr['id']) ? ' id="' . esc_attr($attr['id']) . '"' : '';
$attributes .= ' class="wp-caption ' . esc_attr($attr['align']) . '"';
$attributes .= ' style="max-width: ' . esc_attr($attr['width']) . 'px"';
/* Open the caption <div>. */
$output = '<figure' . $attributes . '>';
/* Allow shortcodes for the content the caption was created for. */
$output .= do_shortcode($content);
/* Append the caption text. */
$output .= '<figcaption class="wp-caption-text">' . $attr['caption'] . '</figcaption>';
/* Close the caption </div>. */
$output .= '</figure>';
/* Return the formatted, clean caption. */
return apply_filters('cleaner_caption', $output);
}