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


PHP get_the_title_rss函数代码示例

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


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

示例1: mdr_postrss

/**
 * Filter to added content to the bottom of rss feeds
 *
 * @param string $content The content of the page/post in the rrs feed.
 *
 * @author Matt Rude <matt@mattrude.com>
 * @package Gus Theme
 * @subpackage Feed Footer
 * @since 0.2
 */
function mdr_postrss($content)
{
    if (is_feed()) {
        $site_name = get_bloginfo_rss('name');
        $post_title = get_the_title_rss();
        $home_url = home_url('/');
        $post_url = post_permalink();
        $content = $content . '<a href="' . $post_url . '">' . $post_title . '</a> is a post from; <a href="' . $home_url . '">' . $site_name . '</a> which is not allowed to be copied on other sites.';
    }
    return $content;
}
开发者ID:SloppierKitty7,项目名称:wp-theme-gus,代码行数:21,代码来源:feed-footer.php

示例2: wp_json_check_url

function wp_json_check_url()
{
    if (preg_match('/\\/feed\\/json\\//', $_SERVER['REQUEST_URI']) || $_REQUEST['feed'] == 'json') {
        header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
        $items = array();
        query_posts("");
        while (have_posts()) {
            the_post();
            $item = array("title" => get_the_title_rss(), "link" => apply_filters('the_permalink_rss', get_permalink()), "description" => apply_filters('the_excerpt_rss', get_the_excerpt()));
            $items[] = $item;
        }
        $arr = array('title' => get_bloginfo_rss('name'), 'link' => get_bloginfo_rss('url'), 'description' => get_bloginfo_rss('description'), 'language' => get_option('rss_language'), 'items' => $items);
        if (function_exists('json_encode')) {
            die("" . $_REQUEST["callback"] . "(" . json_encode($arr) . ");");
        } else {
            //TODO: Add backwards compatibility to before PHP 5.2
            require_once "json.php";
            $json = new Services_JSON();
            die("" . $_REQUEST["callback"] . "(" . $json->encode($arr) . ");");
        }
    }
}
开发者ID:hising,项目名称:wp-json,代码行数:22,代码来源:wp-json.php

示例3: the_title_rss

/**
 * Display the post title in the feed.
 *
 * @since 0.71
 */
function the_title_rss()
{
    echo get_the_title_rss();
}
开发者ID:RA2WP,项目名称:RA2WP,代码行数:9,代码来源:feed.php

示例4: header

 * RSS2 Feed Template for displaying RSS2 Comments feed.
 *
 * @package WordPress
 */
header('Content-Type: text/xml;charset=' . get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title><?php 
if (is_singular()) {
    printf(__('Comments on: %s'), get_the_title_rss());
} elseif (is_search()) {
    printf(__('Comments for %s searching on %s'), get_bloginfo_rss('name'), attribute_escape($wp_query->query_vars['s']));
} else {
    printf(__('Comments for %s'), get_bloginfo_rss('name') . get_wp_title_rss());
}
?>
</title>
	<atom:link href="<?php 
self_link();
?>
" rel="self" type="application/rss+xml" />
	<link><?php 
is_single() ? the_permalink_rss() : bloginfo_rss("url");
?>
</link>
开发者ID:nurpax,项目名称:saastafi,代码行数:31,代码来源:feed-rss2-comments.php

示例5: tLoadFeed

/**
 * Universal Feed Loader
 * hooked function
 * supports custom settings
 * NOTE uses just-in-time initialization
 * @see     functions.php, feed-links include module
 * @uses    Universal Feed Writer class
 */
function tLoadFeed()
{
    global $tFeeds, $tCurrentFeed, $wp_query, $post;
    $tCurrentFeed = get_query_var('feed');
    // FB::trace($tCurrentFeed);
    if (empty($tCurrentFeed) || $tCurrentFeed == 'feed') {
        $tCurrentFeed = get_default_feed();
        # rss2
    }
    $args =& $tFeeds[$tCurrentFeed];
    $defaults = array('num_entries' => get_option('posts_per_rss'), 'do_images' => true, 'size_image' => 'large', 'feed_type' => defined('TFEED') ? TFEED : 'atom', 'feed_title' => 'Recent Posts', 'feed_description' => 'An unfiltered list limited to ' . $num_entries . ' posts');
    $args = apply_filters('t_load_feed_args', $args);
    $args = wp_parse_args($args, $defaults);
    # customizing default info
    if (is_category()) {
        $category = t_get_term_name(get_query_var('cat'), 'category');
        $args['feed_title'] = 'Feed for ' . $category;
        $args['feed_description'] = 'A list limited to ' . $args['num_entries'] . ' posts categorized under ' . $category;
    }
    if ($wp_query->is_comment_feed) {
        # comment feed
        if (is_singular()) {
            $args['feed_title'] = 'Recent comments on ' . get_the_title_rss();
        } elseif (is_search()) {
            $args['feed_title'] = 'Comments for search on ' . attribute_escape($wp_query->query_vars['s']);
        } else {
            $args['feed_title'] = 'Recent comments for ' . get_wp_title_rss();
        }
        $args['feed_title'] = ent2ncr($args['feed_title']);
        $args['feed_description'] = 'A list limited to ' . $args['num_entries'] . ' comments';
    }
    $args['query'] = tGetFeedQuery();
    if (is_array($args['query'])) {
        $args['query']['showposts'] =& $args['num_entries'];
    }
    if ($tCurrentFeed == 'rss' || $tCurrentFeed == 'rss2' || $tCurrentFeed == 'atom') {
        $args['feed_type'] = $tCurrentFeed;
    } else {
        $args['feed_title'] = ucwords(str_replace('_', ' ', $tCurrentFeed));
    }
    extract($args);
    # namespacing
    switch ($feed_type) {
        case 'rss2':
            $namespace = '
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 xmlns:atom="http://www.w3.org/2005/Atom"
                 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
                ';
            $feedType = RSS2;
            break;
        case 'rss':
            $namespace = '
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
                 xmlns:admin="http://webns.net/mvcb/"
                 xmlns:content="http://purl.org/rss/1.0/modules/content/"
                ';
            $feedType = RSS1;
            break;
        case 'atom':
        default:
            $namespace = '
                 xmlns:thr="http://purl.org/syndication/thread/1.0"
                 xml:lang="' . get_option('rss_language') . '"
                 xml:base="' . get_bloginfo_rss('url') . '"
                 ';
            $feedType = ATOM;
            break;
    }
    $GLOBALS['t_feed_ns'] = $namespace;
    # for use in FeedWriter
    add_filter('t_feed_ns', create_function('$default', 'return $default . $GLOBALS["t_feed_ns"];'));
    # start
    $feedWriter = new FeedWriter($feedType);
    require TDIR . TMODINC . 'feed-head.php';
    require TDIR . TMODINC . 'feed-body.php';
    # output
    $out = ob_get_contents();
    $out = str_replace(array("\n", "\r", "\t", ' '), '', $input);
    ob_end_clean();
    $feedWriter->generateFeed();
    // lifestream_rss_feed();
    // FB::info($args);
}
开发者ID:hlfcoding,项目名称:hlf-wordpress,代码行数:93,代码来源:functions.wp-add-feed.php

示例6: jetpack_print_news_sitemap

/**
 * Prints the news XML sitemap conforming to the Sitemaps.org protocol.
 * Outputs an XML list of up to 1000 posts published in the last 2 days.
 *
 * @module sitemaps
 *
 * @link http://sitemaps.org/protocol.php Sitemaps.org protocol.
 */
function jetpack_print_news_sitemap()
{
    $xml = get_transient('jetpack_news_sitemap');
    if ($xml) {
        header('Content-Type: application/xml');
        echo $xml;
        die;
    }
    global $wpdb, $post;
    /**
     * Filter post types to be included in news sitemap.
     *
     * @module sitemaps
     *
     * @since 3.9.0
     *
     * @param array $post_types Array with post types to include in news sitemap.
     */
    $post_types = apply_filters('jetpack_sitemap_news_sitemap_post_types', array('post'));
    if (empty($post_types)) {
        return;
    }
    $post_types_in = array();
    foreach ($post_types as $post_type) {
        $post_types_in[] = $wpdb->prepare('%s', $post_type);
    }
    $post_types_in_string = implode(', ', $post_types_in);
    /**
     * Filter limit of entries to include in news sitemap.
     *
     * @module sitemaps
     *
     * @since 3.9.0
     *
     * @param int $count Number of entries to include in news sitemap.
     */
    $limit = apply_filters('jetpack_sitemap_news_sitemap_count', 1000);
    $cur_datetime = current_time('mysql', true);
    $query = $wpdb->prepare("\n\t\tSELECT p.ID, p.post_title, p.post_type, p.post_date, p.post_name, p.post_date_gmt, GROUP_CONCAT(t.name SEPARATOR ', ') AS keywords\n\t\tFROM\n\t\t\t{$wpdb->posts} AS p LEFT JOIN {$wpdb->term_relationships} AS r ON p.ID = r.object_id\n\t\t\tLEFT JOIN {$wpdb->term_taxonomy} AS tt ON r.term_taxonomy_id = tt.term_taxonomy_id AND tt.taxonomy = 'post_tag'\n\t\t\tLEFT JOIN {$wpdb->terms} AS t ON tt.term_id = t.term_id\n\t\tWHERE\n\t\t\tpost_status='publish' AND post_type IN ( {$post_types_in_string} ) AND post_date_gmt > (%s - INTERVAL 2 DAY)\n\t\tGROUP BY p.ID\n\t\tORDER BY p.post_date_gmt DESC LIMIT %d", $cur_datetime, $limit);
    // URL to XSLT
    $xsl = get_option('permalink_structure') ? home_url('news-sitemap.xsl') : home_url('/?jetpack-news-sitemap-xsl=true');
    // Unless it's zh-cn for Simplified Chinese or zh-tw for Traditional Chinese,
    // trim national variety so an ISO 639 language code as required by Google.
    $language_code = strtolower(get_locale());
    if (in_array($language_code, array('zh_tw', 'zh_cn'))) {
        $language_code = str_replace('_', '-', $language_code);
    } else {
        $language_code = preg_replace('/(_.*)$/i', '', $language_code);
    }
    header('Content-Type: application/xml');
    ob_start();
    echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
    echo '<?xml-stylesheet type="text/xsl" href="' . esc_url($xsl) . '"?>' . "\n";
    echo '<!-- generator="jetpack-' . JETPACK__VERSION . '" -->' . "\n";
    ?>
	<!-- generator="jetpack" -->
	<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
	        xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
	        xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
	        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
		>
		<?php 
    $posts = $wpdb->get_results($query);
    foreach ($posts as $post) {
        setup_postdata($post);
        /**
         * Filter condition to allow skipping specific posts in news sitemap.
         *
         * @module sitemaps
         *
         * @since 3.9.0
         *
         * @param bool $skip Current boolean. False by default, so no post is skipped.
         * @param WP_POST $post Current post object.
         */
        if (apply_filters('jetpack_sitemap_news_skip_post', false, $post)) {
            continue;
        }
        $GLOBALS['post'] = $post;
        $url = array();
        $url['loc'] = get_permalink($post->ID);
        $news = array();
        $news['news:publication']['news:name'] = get_bloginfo_rss('name');
        $news['news:publication']['news:language'] = $language_code;
        $news['news:publication_date'] = jetpack_w3cdate_from_mysql($post->post_date_gmt);
        $news['news:title'] = get_the_title_rss();
        if ($post->keywords) {
            $news['news:keywords'] = html_entity_decode(ent2ncr($post->keywords), ENT_HTML5);
        }
        $url['news:news'] = $news;
        // Add image to sitemap
//.........这里部分代码省略.........
开发者ID:kanei,项目名称:vantuch.cz,代码行数:101,代码来源:sitemaps.php

示例7: do_action

//echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	<?php 
do_action('rss2_ns');
do_action('rss2_comments_ns');
?>
>
<channel>
	<title><?php 
if (is_singular()) {
    printf(ent2ncr(__('Comments on: %s')), get_the_title_rss() . ' by ' . $user_print_name);
} elseif (is_search()) {
    printf(ent2ncr(__('Comments for %s searching on %s')), get_bloginfo_rss('name'), esc_attr($wp_query->query_vars['s']));
} else {
    printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss('name') . ' by ' . $user_print_name . get_wp_title_rss());
}
?>
</title>
	<atom:link href="<?php 
self_link();
?>
" rel="self" type="application/rss+xml" />
	<link><?php 
is_single() ? the_permalink_rss() : bloginfo_rss("url");
?>
</link>
开发者ID:angelmoratilla,项目名称:digressit,代码行数:31,代码来源:user-comments-feed.php

示例8: get_option

global $digressit_commentbrowser, $wp_rewrite, $matches, $wp_query, $wpdb;
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	<?php 
do_action('rss2_ns');
do_action('rss2_comments_ns');
?>
>
<channel>
	<title><?php 
echo get_the_title_rss();
?>
</title>
	<atom:link href="<?php 
self_link();
?>
" rel="self" type="application/rss+xml" />
	<link><?php 
is_single() ? the_permalink_rss() : bloginfo_rss("url");
?>
</link>
	<description><?php 
bloginfo_rss("description");
?>
</description>
	<lastBuildDate><?php 
开发者ID:angelmoratilla,项目名称:digressit,代码行数:31,代码来源:paragraph-level-feed.php

示例9: implode

                } else {
                    $vdate = ';VALUE=DATE';
                    $include_strings[] = $include->format('Ymd');
                }
            }
            ?>
RDATE<?php 
            echo $vdate;
            ?>
:<?php 
            echo implode(',', $include_strings);
            ?>

<?php 
        }
        echo eventorganiser_escape_ical_text(html_entity_decode("SUMMARY: " . get_the_title_rss())) . "\n";
        $excerpt = get_the_excerpt();
        $excerpt = apply_filters('the_excerpt_rss', $excerpt);
        if (!empty($excerpt)) {
            echo eventorganiser_escape_ical_text(html_entity_decode("DESCRIPTION: {$excerpt}")) . "\n";
        }
        $cats = get_the_terms(get_the_ID(), 'event-category');
        if ($cats && !is_wp_error($cats)) {
            $cat_names = wp_list_pluck($cats, 'name');
            $cat_names = array_map('eventorganiser_escape_ical_text', $cat_names);
            ?>
CATEGORIES:<?php 
            echo implode(',', $cat_names);
            ?>

<?php 
开发者ID:windyjonas,项目名称:fredrika,代码行数:31,代码来源:ical.php

示例10: wpcom_print_news_sitemap

function wpcom_print_news_sitemap($format)
{
    if (defined('WPCOM_SKIP_DEFAULT_NEWS_SITEMAP') && WPCOM_SKIP_DEFAULT_NEWS_SITEMAP) {
        return;
    }
    global $wpdb;
    $post_types = apply_filters('wpcom_sitemap_news_sitemap_post_types', array('post'));
    if (empty($post_types)) {
        return;
    }
    $post_types_in = array();
    foreach ($post_types as $post_type) {
        $post_types_in[] = $wpdb->prepare('%s', $post_type);
    }
    $post_types_in_string = implode(', ', $post_types_in);
    $limit = apply_filters('wpcom_sitemap_news_sitemap_count', 1000);
    $cur_datetime = current_time('mysql', true);
    $query = $wpdb->prepare("\n\t\tSELECT p.ID, p.post_title, p.post_type, p.post_date, p.post_name, p.post_date_gmt, GROUP_CONCAT(t.name SEPARATOR ', ') AS keywords\n\t\tFROM\n\t\t\t{$wpdb->posts} AS p LEFT JOIN {$wpdb->term_relationships} AS r ON p.ID = r.object_id\n\t\t\tLEFT JOIN {$wpdb->term_taxonomy} AS tt ON r.term_taxonomy_id = tt.term_taxonomy_id AND tt.taxonomy = 'post_tag'\n\t\t\tLEFT JOIN {$wpdb->terms} AS t ON tt.term_id = t.term_id\n\t\tWHERE\n\t\t\tpost_status='publish' AND post_type IN ( {$post_types_in_string} ) AND post_date_gmt > (%s - INTERVAL 2 DAY)\n\t\tGROUP BY p.ID\n\t\tORDER BY p.post_date_gmt DESC LIMIT %d", $cur_datetime, $limit);
    header('Content-Type: application/xml');
    echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
    ?>
<!-- generator="wordpress.com" -->
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
	xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
	xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
	xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
	>
<?php 
    $posts = $wpdb->get_results($query);
    foreach ($posts as $post) {
        // Add in filter to allow skipping specific posts
        if (apply_filters('wpcom_sitemap_news_skip_post', false, $post)) {
            continue;
        }
        $GLOBALS['post'] = $post;
        $url = array();
        $url['loc'] = get_permalink($post->ID);
        $news = array();
        $news['news:publication']['news:name'] = get_bloginfo_rss('name');
        if (function_exists('get_blog_lang_code')) {
            $news['news:publication']['news:language'] = get_blog_lang_code();
        }
        $news['news:publication_date'] = w3cdate_from_mysql($post->post_date_gmt);
        $news['news:title'] = get_the_title_rss();
        if ($post->keywords) {
            $news['news:keywords'] = html_entity_decode(ent2ncr($post->keywords), ENT_HTML5);
        }
        $url['news:news'] = $news;
        // Add image to sitemap
        if (current_theme_supports('post-thumbnails') && has_post_thumbnail($post->ID)) {
            $post_thumbnail_id = get_post_thumbnail_id($post->ID);
            $post_thumbnail_src = wp_get_attachment_image_src($post_thumbnail_id);
            if ($post_thumbnail_src) {
                $url['image:image'] = array('image:loc' => esc_url($post_thumbnail_src[0]));
            }
        }
        $url = apply_filters('wpcom_sitemap_news_sitemap_item', $url, $post);
        if (empty($url)) {
            continue;
        }
        wpcom_print_sitemap_item($url);
    }
    ?>
</urlset>
<?php 
    die;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:68,代码来源:wpcom-sitemap.php

示例11: urlencode

?>
&amp;t=<?php 
echo urlencode(get_the_title_rss());
?>
" title="<?php 
_e('Share this on Facebook', 'onemozilla');
?>
"><span><?php 
_e('Share this on Facebook', 'onemozilla');
?>
</span></a></li>
      <li><a class="twitter" href="https://twitter.com/intent/tweet?url=<?php 
echo wp_get_shortlink();
?>
&amp;text=<?php 
echo urlencode(get_the_title_rss() . ' - ');
?>
&amp;via=firefox" title="<?php 
_e('Share this on Twitter', 'onemozilla');
?>
"><span><?php 
_e('Share this on Twitter', 'onemozilla');
?>
</span></a></li>
    </ul>

  <?php 
if ('post' == get_post_type()) {
    // Hide category and tag text for pages on Search
    ?>
		<?php 
开发者ID:stejmurphy,项目名称:torch,代码行数:31,代码来源:content-single.php

示例12: array

 }
 if (!empty($schedule_data['include'])) {
     $include_strings = array();
     foreach ($schedule_data['include'] as $include) {
         if (!eo_is_all_day()) {
             $vdate = '';
             $include->setTimezone($UTC_tz);
             $include_strings[] = $include->format('Ymd\\THis\\Z');
         } else {
             $vdate = ';VALUE=DATE';
             $include_strings[] = $include->format('Ymd');
         }
     }
     echo "RDATE" . $vdate . ":" . implode(',', $include_strings) . "\r\n";
 }
 echo eventorganiser_fold_ical_text('SUMMARY: ' . eventorganiser_escape_ical_text(html_entity_decode(get_the_title_rss(), ENT_COMPAT, 'UTF-8'))) . "\r\n";
 $description = wp_strip_all_tags(html_entity_decode(get_the_excerpt(), ENT_COMPAT, 'UTF-8'));
 $description = ent2ncr(convert_chars($description));
 /**
  * Filters the description of the event as it appears in the iCal feed.
  *
  * @param string $description The event description
  */
 $description = apply_filters('eventorganiser_ical_description', $description);
 $description = eventorganiser_escape_ical_text($description);
 if (!empty($description)) {
     echo eventorganiser_fold_ical_text("DESCRIPTION: {$description}") . "\r\n";
 }
 $description = wpautop(html_entity_decode(get_the_content(), ENT_COMPAT, 'UTF-8'));
 $description = str_replace("\r\n", '', $description);
 //Remove new lines
开发者ID:blogfor,项目名称:king,代码行数:31,代码来源:ical.php

示例13: get_sitemap_xml

 /**
  * Generate XML Sitemap with SimpleXMLElement
  * @return string
  * @todo Make number of posts configurable via querystring
  * @link http://support.google.com/webmasters/answer/183668 ()
  */
 function get_sitemap_xml($show_all = false)
 {
     $xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-news/0.9 http://www.google.com/schemas/sitemap-news/0.9/sitemap-news.xsd"></urlset>');
     // Setup Pagination
     $page = get_query_var('page', 0);
     // Get available public custom post types
     $custom_post_types = get_post_types(array('public' => true, 'exclude_from_search' => false, '_builtin' => false));
     // Limit/filter posts from last week
     $date_query = array(array('after' => '1 week ago'));
     // Generate base arguments for WP_Query
     $args = array('post_type' => array_merge(array('post', 'page'), $custom_post_types), 'orderby' => 'modified', 'order' => 'DESC');
     // Use Pagination if "?page=1" is passed
     if ($show_all) {
         $args['posts_per_page'] = -1;
     } elseif ($page) {
         $args['posts_per_page'] = $this->posts_per_page;
         $args['paged'] = $page;
     } else {
         $args['nopaging'] = true;
         $args['date_query'] = $date_query;
         // Don't use date-based query if pagination is enabled
     }
     // Run WP_Query
     $query = new \WP_Query($args);
     // Add attributes for debugging purposes
     $xml->addAttribute('generated', date(\DateTime::RSS));
     if ($page) {
         $xml->addAttribute('page', $page);
         $xml->addAttribute('maxpages', $query->max_num_pages);
     }
     // Just exit with 404 response if no posts returned
     if (!$query->have_posts()) {
         $this->return_404();
     }
     // Add site url to top of sitemap
     if ($page <= 1) {
         $home = $xml->addChild('url');
         $home->addChild('loc', get_site_url());
         $home->addChild('changefreq', 'always');
         $home->addChild('priority', '1.0');
     }
     // Iterate over all posts
     while ($query->have_posts()) {
         $query->the_post();
         $item = $xml->addChild('url');
         $item->addChild('loc', get_the_permalink());
         $item->addChild('lastmod', get_the_modified_date(DATE_W3C));
         // get get_the_modified_date from the first tiem for our Last Modified HTTP header
         if (!$this->last_modified_header) {
             $this->last_modified_header = get_the_modified_date($this::UTC_DATE_FORMAT);
         }
         if (has_post_thumbnail()) {
             $featured_image = get_post(get_post_thumbnail_id());
             if (isset($featured_image->ID)) {
                 $thumb = wp_get_attachment_image_src($featured_image->ID, 'large');
                 $thumb_url = $thumb['0'];
                 $image = $item->addChild('image:image', NULL, $this::ns_sitemap_image);
                 $image->addChild('image:loc', $thumb_url, $this::ns_sitemap_image);
                 $image->addChild('image:title', htmlspecialchars($featured_image->post_title), $this::ns_sitemap_image);
                 $image->addChild('image:caption', htmlspecialchars($featured_image->post_excerpt), $this::ns_sitemap_image);
                 // UTF8 Debug Test
                 // $utf8_sample = 'I am text with Ünicödé & HTML €ntities ©';
                 // $image->addChild('image:title', htmlspecialchars($utf8_sample), $this::ns_sitemap_image);
                 // $image->addChild('image:caption', htmlspecialchars($utf8_sample), $this::ns_sitemap_image);
             }
         }
         $news = $item->addChild('news:news', NULL, $this::ns_sitemap_news);
         $news->addChild('news:publication_date', get_the_date(DATE_W3C));
         $news->addChild('news:title', get_the_title_rss());
         // TODO: Not sure if news:genres should be included or not
         // $news->addChild('news:genres', 'PressRelease, Blog'); // https://support.google.com/news/publisher/answer/93992
         $publication = $news->addChild('news:publication');
         $publication->addChild('news:name', get_bloginfo_rss('name'));
         $publication->addChild('news:language', get_bloginfo_rss('language'));
     }
     wp_reset_query();
     // Advertise taxonomy terms on regular non-paginated sitemap
     if ($args['nopaging'] = true) {
         // Get all categories
         foreach (get_categories() as $category) {
             $item = $xml->addChild('url');
             $item->addChild('loc', get_category_link($category->term_id));
         }
         // Get all tags
         foreach (get_tags() as $tag) {
             $item = $xml->addChild('url');
             $item->addChild('loc', get_tag_link($tag->term_id));
         }
     }
     // Attach query details to attributes if debugging is enabled
     if (WP_DEBUG) {
         $xml->addAttribute('debug', get_num_queries() . ' queries in ' . timer_stop(0) . ' seconds');
     }
     return $xml->asXML();
//.........这里部分代码省略.........
开发者ID:micahtaylor,项目名称:wordpress-xml-sitemap,代码行数:101,代码来源:XMLSitemap.php

示例14: apply_filters

    return apply_filters('bfox_plan_update_frequency_rss', (int) bfox_plan_meta('per_day', $post_id));
}
function bfox_plan_last_build_date_rss($format = 'D, d M Y H:i:s +0000', $post_id = 0)
{
    $last_reading_date = bfox_plan_reading_gmdate(bfox_plan_latest_reading(), $format);
    $last_reading_time = strtotime($last_reading_date);
    $post = get_post($post_id);
    $last_save_date = mysql2date($format, $post->post_modified_gmt, false);
    $last_save_time = strtotime($last_save_date);
    if ($last_save_time > $last_reading_time) {
        return $last_save_date;
    } else {
        return $last_reading_date;
    }
}
function bfox_plan_ical_print_array($arr)
{
    foreach ($arr as $key => $value) {
        echo "{$key}:{$value}\n";
    }
}
header('Content-Type: text/calendar; charset=' . get_option('blog_charset'), true);
bfox_plan_ical_print_array(array('BEGIN' => 'VCALENDAR', 'PRODID' => '-//Epicfox//Biblefox for WordPress//EN', 'VERSION' => '2.0', 'CALSCALE' => 'GREGORIAN', 'METHOD' => 'PUBLISH', 'X-WR-CALNAME' => get_the_title_rss(), 'X-WR-TIMEZONE' => get_option('timezone_string'), 'X-WR-CALDESC' => get_the_excerpt()));
while (have_posts()) {
    the_post();
    for ($reading_id = bfox_plan_reading_count() - 1; $reading_id >= 0; $reading_id--) {
        $arr = array('BEGIN' => 'VEVENT', 'DTSTART;VALUE=DATE' => bfox_plan_reading_date($reading_id, 'Ymd'), 'DTEND;VALUE=DATE' => date('Ymd', strtotime(bfox_plan_reading_date($reading_id, 'Ymd') . ' + 1 day')), 'DTSTAMP' => bfox_plan_reading_gmdate($reading_id, 'Ymd\\THis\\Z'), 'UID' => bfox_plan_reading_guid($reading_id), 'URL' => esc_url(bfox_plan_reading_url($reading_id)), 'CREATED' => bfox_plan_reading_gmdate($reading_id, 'Ymd\\THis\\Z'), 'SUMMARY' => sprintf(__('#%d: %s', 'bfox'), $reading_id + 1, bfox_plan_reading_ref_str($reading_id, 0, BibleMeta::name_short)), 'LAST-MODIFIED' => bfox_plan_reading_gmdate($reading_id, 'Ymd\\THis\\Z'), 'LOCATION' => '', 'SEQUENCE' => 0, 'STATUS' => 'CONFIRMED', 'TRANSP' => 'OPAQUE', 'END' => 'VEVENT');
        bfox_plan_ical_print_array($arr);
    }
}
echo "END:VCALENDAR\n";
开发者ID:jeffryevans,项目名称:biblefox-wp,代码行数:31,代码来源:ical-bfox_plan.php

示例15: podPress_rss2_item

function podPress_rss2_item()
{
    global $podPress, $post, $post_meta_cache, $blog_id, $wp_version;
    $enclosureTag = podPress_getEnclosureTags();
    if ($enclosureTag != '') {
        // if no enclosure tag, no need for iTunes tags
        $is_password_protected = podpress_post_is_password_protected();
        if (FALSE === $is_password_protected) {
            echo $enclosureTag;
        }
        if ($post->podPressPostSpecific['itunes:subtitle'] == '##PostExcerpt##') {
            if (TRUE === $is_password_protected) {
                $post->podPressPostSpecific['itunes:subtitle'] = __('This post is password protected.', 'podPress');
            } else {
                $post->podPressPostSpecific['itunes:subtitle'] = trim(podpress_get_excerpt_rss());
            }
        }
        if (TRUE == empty($post->podPressPostSpecific['itunes:subtitle'])) {
            $post->podPressPostSpecific['itunes:subtitle'] = get_the_title_rss();
        }
        echo '		<itunes:subtitle>' . podPress_strlimiter_end(podPress_feedSafeContent(stripslashes($post->podPressPostSpecific['itunes:subtitle']), FALSE, TRUE), 254, '[...]', TRUE) . '</itunes:subtitle>' . "\n";
        if (FALSE == isset($post->podPressPostSpecific['itunes:summary'])) {
            $post->podPressPostSpecific['itunes:summary'] = '##PostContentShortened##';
        }
        switch ($post->podPressPostSpecific['itunes:summary']) {
            case '##Global##':
                $post->podPressPostSpecific['itunes:summary'] = $podPress->settings['iTunes']['summary'];
                break;
            case '##PostExcerpt##':
                if (TRUE === $is_password_protected) {
                    $post->podPressPostSpecific['itunes:summary'] = __('This post is password protected.', 'podPress');
                } else {
                    $post->podPressPostSpecific['itunes:summary'] = trim(podpress_get_excerpt_rss());
                }
                break;
            case '##PostContentShortened##':
                if (post_password_required($post)) {
                    $post->podPressPostSpecific['itunes:summary'] = __('This post is password protected.', 'podPress');
                } else {
                    if (TRUE == version_compare($wp_version, '2.9', '>=')) {
                        $post->podPressPostSpecific['itunes:summary'] = get_the_content_feed();
                    } else {
                        $post->podPressPostSpecific['itunes:summary'] = trim(podpress_get_content_rss());
                    }
                }
                break;
        }
        if (FALSE == empty($post->podPressPostSpecific['itunes:summary'])) {
            echo '		<itunes:summary>' . podPress_strlimiter_end(podPress_feedSafeContent(stripslashes($post->podPressPostSpecific['itunes:summary']), FALSE, TRUE), 4000, '[...]', TRUE) . '</itunes:summary>' . "\n";
        }
        switch ($post->podPressPostSpecific['itunes:keywords']) {
            default:
            case '##WordPressCats##':
                $categories = get_the_category();
                $post->podPressPostSpecific['itunes:keywords'] = '';
                if (TRUE == is_array($categories) and FALSE == empty($categories)) {
                    $category_names = array();
                    $b = '';
                    foreach ($categories as $category) {
                        $result = preg_match('/\\S+\\s+\\S+/', $category->cat_name, $b);
                        // take the category name only if it does not contain inner white spaces (if it does not consist of more than one word)
                        if (TRUE == empty($b)) {
                            $category_names[] = $category->cat_name;
                        }
                    }
                    if (TRUE == is_array($category_names) and FALSE == empty($category_names)) {
                        $nr_category_names = count($category_names);
                        if ($nr_category_names > 1) {
                            for ($i = 0; $i < min($nr_category_names, 12); $i++) {
                                // max. 12 keywords are allowed
                                if (0 == $i) {
                                    $post->podPressPostSpecific['itunes:keywords'] = $category_names[$i];
                                } else {
                                    $post->podPressPostSpecific['itunes:keywords'] .= ', ' . $category_names[$i];
                                }
                            }
                        } elseif ($nr_category_names === 1) {
                            $post->podPressPostSpecific['itunes:keywords'] = $category_names[0];
                        }
                    }
                }
                break;
            case '##post_tags##':
                $posttags = get_the_tags();
                $post->podPressPostSpecific['itunes:keywords'] = '';
                if (is_array($posttags) and FALSE == empty($posttags)) {
                    $posttags_nr = count($posttags);
                    $i = 0;
                    foreach ($posttags as $tag) {
                        if ($i == $posttags_nr - 1) {
                            $post->podPressPostSpecific['itunes:keywords'] .= $tag->name;
                        } else {
                            $post->podPressPostSpecific['itunes:keywords'] .= $tag->name . ', ';
                        }
                        $i++;
                    }
                }
                break;
            case '##Global##':
                $post->podPressPostSpecific['itunes:keywords'] = $podPress->settings['iTunes']['keywords'];
//.........这里部分代码省略.........
开发者ID:niko-lgdcom,项目名称:archives,代码行数:101,代码来源:podpress_feed_functions.php


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