本文整理汇总了PHP中is_feed函数的典型用法代码示例。如果您正苦于以下问题:PHP is_feed函数的具体用法?PHP is_feed怎么用?PHP is_feed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_feed函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 />";
}
}
开发者ID:sorich87,项目名称:better-click-to-tweet,代码行数:27,代码来源:better-click-to-tweet.php
示例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;
}
开发者ID:bobth1019,项目名称:inc,代码行数:32,代码来源:header-functions.php
示例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 '';
}
开发者ID:ugurozer,项目名称:little,代码行数:30,代码来源:tiled-gallery.php
示例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;
}
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:60,代码来源:instagram.php
示例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;
}
开发者ID:sfmoma,项目名称:sfmoma2011-wptheme,代码行数:7,代码来源:functions.php
示例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;
}
}
开发者ID:albinmartinsson91,项目名称:ux_blog,代码行数:11,代码来源:class.photocrati_resource_manager.php
示例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 '';
}
开发者ID:janeczku,项目名称:AA-Basic-Shortcode-Plugin-Boilerplate,代码行数:16,代码来源:aa_login_users_only.php
示例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;
}
开发者ID:amyevans,项目名称:makewpplugin,代码行数:7,代码来源:amysexperiments.php
示例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;
}
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:9,代码来源:class.php
示例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;
}
开发者ID:hchouhan,项目名称:books-by-themeist,代码行数:7,代码来源:includes.php
示例11: shot_get_posts
function shot_get_posts($query)
{
if (is_home() || is_feed()) {
$query->set('post_type', array('post', 'link', 'attachment'));
}
return $query;
}
开发者ID:rmccue,项目名称:Beached,代码行数:7,代码来源:functions.php
示例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;
}
开发者ID:karlforshaw,项目名称:One-Panel,代码行数:26,代码来源:feedburner.php
示例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');
}
}
开发者ID:SSRezhepa,项目名称:prodvizhenie.ru,代码行数:33,代码来源:autoptimize.php
示例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;
}
开发者ID:brittbec13,项目名称:citizenmodern,代码行数:33,代码来源:sfsiocns_OnPosts.php
示例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);
}
开发者ID:enamakel,项目名称:steven.pw-theme,代码行数:44,代码来源:cleaner-caption.php
示例16: photoline_modified_post_gallery
function photoline_modified_post_gallery($output, $attr)
{
global $post;
static $instance = 0;
$instance++;
//disable all filter
if (empty($attr['type']) || $attr['type'] != 'slider') {
return;
}
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if (!$attr['orderby']) {
unset($attr['orderby']);
}
}
extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'size' => 'photoline-featured', 'include' => '', 'exclude' => ''), $attr));
$id = intval($id);
if ('RAND' == $order) {
$orderby = 'none';
}
if (!empty($include)) {
$include = preg_replace('/[^0-9,]+/', '', $include);
$_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
$attachments = array();
foreach ($_attachments as $key => $val) {
$attachments[$val->ID] = $_attachments[$key];
}
} elseif (!empty($exclude)) {
$exclude = preg_replace('/[^0-9,]+/', '', $exclude);
$attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
} else {
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
}
if (empty($attachments)) {
return '';
}
if (is_feed()) {
$output = "\n";
foreach ($attachments as $att_id => $attachment) {
$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
}
return $output;
}
$selector = "gallery-{$instance}";
$size_class = sanitize_html_class($size);
$gallery_div = "<div id='{$selector}' class='gallery galleryid-{$id} gallery-size-{$size_class} flexslider'>";
$output = apply_filters('gallery_style', $gallery_div);
$output .= '<ul class="slides">';
$i = 0;
foreach ($attachments as $id => $attachment) {
$caption = !empty($attachment->post_excerpt) ? '<p class="flex-caption wp-caption-text gallery-caption">' . wptexturize($attachment->post_excerpt) . '</p>' : '';
$image = wp_get_attachment_image($id, $size);
$output .= '<li>';
$output .= $image;
$output .= $caption;
$output .= '</li>';
}
$output .= "\r\n </ul><!-- .slides -->\r\n </div>\n";
return $output;
}
开发者ID:AlexanderDolgan,项目名称:ojahuri,代码行数:60,代码来源:gallery-layout.php
示例17: filter_the_content
function filter_the_content($content)
{
if (is_feed()) {
return $content;
}
return preg_replace_callback('/(<\\s*img[^>]+)(src\\s*=\\s*"[^"]+")([^>]+>)/i', array($this, 'preg_replace_callback'), $content);
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:7,代码来源:wp_images_lazy_loading.php
示例18: archives_shortcode
function archives_shortcode($attr)
{
if (is_feed()) {
return '[archives]';
}
global $allowedposttags;
$default_atts = array('type' => 'postbypost', 'limit' => '', 'format' => 'html', 'showcount' => false, 'before' => '', 'after' => '', 'order' => 'desc');
extract(shortcode_atts($default_atts, $attr));
if (!in_array($type, array('yearly', 'monthly', 'daily', 'weekly', 'postbypost'))) {
$type = 'postbypost';
}
if (!in_array($format, array('html', 'option', 'custom'))) {
$format = 'html';
}
if ('' != $limit) {
$limit = (int) $limit;
}
$showcount = (bool) $showcount;
$before = wp_kses($before, $allowedposttags);
$after = wp_kses($after, $allowedposttags);
// Get the archives
$archives = wp_get_archives('type=' . $type . '&limit=' . $limit . '&format=' . $format . '&echo=0&show_post_count=' . $showcount . '&before=' . $before . '&after=' . $after);
if ('asc' == $order) {
$archives = implode("\n", array_reverse(explode("\n", $archives)));
}
// Check to see if there are any archives
if (empty($archives)) {
$archives = '<p>' . __('Your blog does not currently have any published posts.', 'jetpack') . '</p>';
} elseif ('option' == $format) {
$archives = "<select name='archive-dropdown' onchange='document.location.href=this.options[this.selectedIndex].value;'><option value='" . get_permalink() . "'>--</option>" . $archives . "</select>";
} elseif ('html' == $format) {
$archives = '<ul>' . $archives . '</ul>';
}
return $archives;
}
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:35,代码来源:archives.php
示例19: document_title
function document_title($title = '', $sep = '-', $seplocation = 'right')
{
// Remove default seperator and add spacing
if (trim($sep) === '' || $sep === '»' || $sep === '»') {
$sep = '-';
}
$sep = ' ' . $sep . ' ';
// Determine page number, if any
$page_num = '';
if (is_paged()) {
global $page, $paged;
if ($paged >= 2 || $page >= 2) {
$page_num = $sep . sprintf(esc_html__('Page %d', 'ubik'), max($paged, $page));
}
}
// Generate the title using our all-purpose title function
$title = apply_filters('ubik_seo_document_title_raw', ubik_title());
$name = get_bloginfo('name');
$desc = get_bloginfo('description');
// Handle three scenarios: home/front page, archive feeds, and everything else
if (is_front_page() || is_home()) {
$title = $name;
if (!empty($desc) && !is_paged()) {
$title .= $sep . $desc;
}
} elseif (is_feed() && is_archive()) {
$title = $sep . $title;
// Adding the separator alters the default archive feed title output
} else {
$title = $title . $sep . $name;
}
// Sanitize and add page number as needed
$title = esc_html(strip_tags(stripslashes(preg_replace('/\\s+/', ' ', trim($title . $page_num)))));
return apply_filters('ubik_seo_document_title_final', $title);
}
开发者ID:synapticism,项目名称:ubik,代码行数:35,代码来源:seo.php
示例20: member_check_shortcode
function member_check_shortcode($atts, $content = null)
{
if (is_user_logged_in() && !is_null($content) && !is_feed()) {
return $content;
}
return '';
}
开发者ID:kristinakarnitskaya,项目名称:larkyonline,代码行数:7,代码来源:functions.php
注:本文中的is_feed函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论