本文整理汇总了PHP中the_permalink_rss函数的典型用法代码示例。如果您正苦于以下问题:PHP the_permalink_rss函数的具体用法?PHP the_permalink_rss怎么用?PHP the_permalink_rss使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_permalink_rss函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
/**
* RSS 0.92 Feed Template for displaying RSS 0.92 Posts feed.
*
* @package WordPress
*/
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
$more = 1;
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
<rss version="0.92">
<channel>
<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
<link><?php bloginfo_rss('url') ?></link>
<description><?php bloginfo_rss('description') ?></description>
<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
<docs>http://backend.userland.com/rss092</docs>
<language><?php echo get_option('rss_language'); ?></language>
<?php do_action('rss_head'); ?>
<?php while (have_posts()) : the_post(); ?>
<item>
<title><?php the_title_rss() ?></title>
<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
<link><?php the_permalink_rss() ?></link>
<?php do_action('rss_item'); ?>
</item>
<?php endwhile; ?>
</channel>
</rss>
示例2: permalink_single_rss
/**
* Print the permalink to the RSS feed.
*
* @since 0.71
* @deprecated 2.3
* @deprecated Use the_permalink_rss()
* @see the_permalink_rss()
*
* @param string $deprecated
*/
function permalink_single_rss($deprecated = '')
{
_deprecated_function(__FUNCTION__, '2.3', 'the_permalink_rss()');
the_permalink_rss();
}
示例3: handle_export
//.........这里部分代码省略.........
?>
</wp:wxr_version>
<wp:base_site_url><?php
echo wxr_site_url();
?>
</wp:base_site_url>
<wp:base_blog_url><?php
bloginfo_rss('url');
?>
</wp:base_blog_url>
<?php
if ($post_ids) {
global $wp_query;
$wp_query->in_the_loop = true;
// Fake being in the loop.
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_posts = array_splice($post_ids, 0, 20)) {
$where = 'WHERE ID IN (' . join(',', $next_posts) . ')';
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where}");
// Begin Loop
foreach ($posts as $post) {
setup_postdata($post);
$is_sticky = is_sticky($post->ID) ? 1 : 0;
?>
<item>
<?php
/** This filter is documented in wp-includes/feed.php */
?>
<title><?php
echo apply_filters('the_title_rss', $post->post_title);
?>
</title>
<link><?php
the_permalink_rss();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
?>
</pubDate>
<dc:creator><?php
echo wxr_cdata(get_the_author_meta('login'));
?>
</dc:creator>
<guid isPermaLink="false"><?php
the_guid();
?>
</guid>
<description></description>
<content:encoded><?php
echo wxr_cdata(apply_filters('the_content_export', $post->post_content));
?>
</content:encoded>
<excerpt:encoded><?php
echo wxr_cdata(apply_filters('the_excerpt_export', $post->post_excerpt));
?>
</excerpt:encoded>
<wp:post_id><?php
echo $post->ID;
?>
</wp:post_id>
<wp:post_date><?php
echo $post->post_date;
?>
</wp:post_date>
<wp:post_date_gmt><?php
示例4: export_wp
//.........这里部分代码省略.........
if ('all' == $args['post_type']) {
wxr_nav_menu_terms();
}
?>
<?php
do_action('rss2_head');
?>
<?php
$this->flush_export($full_path, false);
?>
<?php
if ($post_ids) {
global $wp_query, $post;
$wp_query->in_the_loop = true;
// Fake being in the loop.
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_posts = array_splice($post_ids, 0, 20)) {
$where = 'WHERE ID IN (' . join(',', $next_posts) . ')';
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where}");
// Begin Loop
foreach ($posts as $post) {
$progress->tick();
setup_postdata($post);
$is_sticky = is_sticky($post->ID) ? 1 : 0;
?>
<item>
<title><?php
echo apply_filters('the_title_rss', $post->post_title);
?>
</title>
<link><?php
the_permalink_rss();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
?>
</pubDate>
<dc:creator><?php
echo get_the_author_meta('login');
?>
</dc:creator>
<guid isPermaLink="false"><?php
esc_url(the_guid());
?>
</guid>
<description></description>
<content:encoded><?php
echo wxr_cdata(apply_filters('the_content_export', $post->post_content));
?>
</content:encoded>
<excerpt:encoded><?php
echo wxr_cdata(apply_filters('the_excerpt_export', $post->post_excerpt));
?>
</excerpt:encoded>
<wp:post_id><?php
echo $post->ID;
?>
</wp:post_id>
<wp:post_date><?php
echo $post->post_date;
?>
</wp:post_date>
<wp:post_date_gmt><?php
示例5: do_action
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());
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' ) . 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>
<description><?php bloginfo_rss("description") ?></description>
<lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate>
<sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
<sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
<?php do_action('commentsrss2_head'); ?>
<?php
if ( have_comments() ) : while ( have_comments() ) : the_comment();
$comment_post = get_post($comment->comment_post_ID);
get_post_custom($comment_post->ID);
?>
<item>
<title><?php
if ( !is_singular() ) {
$title = get_the_title($comment_post->ID);
$title = apply_filters('the_title_rss', $title);
示例6: dsq_export_wp
function dsq_export_wp($post, $comments = null)
{
global $wpdb;
if (!$comments) {
$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%%'", $post->ID));
}
// start catching output
ob_start();
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
the_generator('export');
?>
<rss version="2.0"
xmlns:excerpt="http://wordpress.org/export/<?php
echo WXR_VERSION;
?>
/excerpt/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="https://disqus.com/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/<?php
echo WXR_VERSION;
?>
/"
>
<channel>
<title><?php
bloginfo_rss('name');
?>
</title>
<link><?php
bloginfo_rss('url');
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false);
?>
</pubDate>
<generator>WordPress <?php
bloginfo_rss('version');
?>
; Disqus <?php
echo DISQUS_VERSION;
?>
</generator>
<?php
global $wp_query, $post;
$wp_query->in_the_loop = true;
// Fake being in the loop.
setup_postdata($post);
?>
<item>
<title><?php
echo apply_filters('the_title_rss', $post->post_title);
?>
</title>
<link><?php
the_permalink_rss();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
?>
</pubDate>
<dc:creator><?php
echo dsq_export_wxr_cdata(get_the_author());
?>
</dc:creator>
<guid isPermaLink="false"><?php
the_guid();
?>
</guid>
<content:encoded><?php
echo dsq_export_wxr_cdata(apply_filters('the_content_export', $post->post_content));
?>
</content:encoded>
<dsq:thread_identifier><?php
echo dsq_identifier_for_post($post);
?>
</dsq:thread_identifier>
<wp:post_id><?php
echo $post->ID;
?>
</wp:post_id>
<wp:post_date_gmt><?php
echo $post->post_date_gmt;
?>
</wp:post_date_gmt>
<wp:comment_status><?php
echo $post->comment_status;
?>
</wp:comment_status>
<?php
if ($comments) {
foreach ($comments as $c) {
?>
<wp:comment>
<wp:comment_id><?php
echo $c->comment_ID;
//.........这里部分代码省略.........
示例7: export_wp
//.........这里部分代码省略.........
<wp:tag><wp:tag_slug><?php
echo $t->slug;
?>
</wp:tag_slug><?php
wxr_tag_name($t);
wxr_tag_description($t);
?>
</wp:tag>
<?php
}
}
?>
<?php
do_action('rss2_head');
?>
<?php
if ($post_ids) {
global $wp_query;
$wp_query->in_the_loop = true;
// Fake being in the loop.
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_posts = array_splice($post_ids, 0, 20)) {
$where = "WHERE ID IN (" . join(',', $next_posts) . ")";
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where} ORDER BY post_date_gmt ASC");
foreach ($posts as $post) {
setup_postdata($post);
?>
<item>
<title><?php
echo apply_filters('the_title_rss', $post->post_title);
?>
</title>
<link><?php
the_permalink_rss();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
?>
</pubDate>
<dc:creator><?php
echo wxr_cdata(get_the_author());
?>
</dc:creator>
<?php
wxr_post_taxonomy();
?>
<guid isPermaLink="false"><?php
the_guid();
?>
</guid>
<description></description>
<content:encoded><?php
echo wxr_cdata(apply_filters('the_content_export', $post->post_content));
?>
</content:encoded>
<excerpt:encoded><?php
echo wxr_cdata(apply_filters('the_excerpt_export', $post->post_excerpt));
?>
</excerpt:encoded>
<wp:post_id><?php
echo $post->ID;
?>
</wp:post_id>
<wp:post_date><?php
示例8: export_wp
//.........这里部分代码省略.........
}
?>
<?php
if ($tags) {
?>
<tags><![CDATA[<?php
echo serialize($tags);
?>
]]></tags><?php
}
?>
<?php
do_action('rss2_head');
?>
<?php
if ($post_ids) {
global $wp_query;
$wp_query->in_the_loop = true;
// Fake being in the loop.
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_posts = array_splice($post_ids, 0, 20)) {
$where = "WHERE ID IN (" . join(',', $next_posts) . ") and post_status != 'inherit'";
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where} ORDER BY post_date_gmt ASC");
foreach ($posts as $post) {
setup_postdata($post);
?>
<item>
<title><?php
the_title_rss();
?>
</title>
<link><?php
the_permalink_rss();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
?>
</pubDate>
<dc:creator><?php
the_author();
?>
</dc:creator>
<?php
wxr_post_taxonomy();
?>
<content><![CDATA[<?php
echo $post->post_content;
?>
]]></content>
<wp:post_id><?php
echo $post->ID;
?>
</wp:post_id>
<wp:post_date><?php
echo $post->post_date;
?>
</wp:post_date>
<wp:post_date_gmt><?php
echo $post->post_date_gmt;
?>
</wp:post_date_gmt>
<wp:comment_status><?php
echo $post->comment_status;
?>
示例9: popular_rss
function popular_rss()
{
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
preg_match('{(\\d{1,2})/(\\d{1,2})/popular.xml}', $_SERVER['REQUEST_URI'], $match);
$max_posts = (int) $match[1];
if ($max_posts < 1 || $max_posts > 25) {
wp_die('Max popular posts should be between 1 and 25.');
}
$days = (int) $match[2];
if ($days < 1 || $days > 90) {
wp_die('The no. of days should be between 1 and 90.');
}
if (function_exists('wpcom_vip_load_helper_stats')) {
wpcom_vip_load_helper_stats();
}
$feed_max_posts = $max_posts + 20;
$popular_data = wpcom_vip_top_posts_array($days, $feed_max_posts);
//print_r ($popular_data);
foreach ($popular_data as $p) {
if ($p["post_id"] != 0) {
$popular_posts[] = $p["post_id"];
}
}
$the_query = new WP_Query(array('post__in' => $popular_posts, 'orderby' => 'post__in', 'posts_per_page' => $max_posts, 'ignore_sticky_posts' => 1));
echo '<?xml version="1.0"?>';
?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title><?php
bloginfo_rss('name');
wp_title_rss();
?>
</title>
<link><?php
bloginfo_rss('url');
?>
</link>
<description><?php
bloginfo_rss("description");
?>
</description>
<image>
<url><?php
echo home_url();
?>
/wp-content/themes/vip/jptechcrunch/images/site-logo-small.png</url>
<title><?php
bloginfo_rss('name');
wp_title_rss();
?>
</title>
<link><?php
bloginfo_rss('url');
?>
</link>
</image>
<language><?php
echo get_option('rss_language');
?>
</language>
<copyright>Copyright <?php
echo date('Y');
?>
TechCrunch The contents of this feed are available for non-commercial use only.</copyright>
<?php
global $post;
while ($the_query->have_posts()) {
$the_query->the_post();
?>
<item>
<title><![CDATA[<?php
the_title_rss();
?>
]]></title>
<link><![CDATA[<?php
the_permalink_rss();
?>
]]></link>
<guid isPermaLink="true"><![CDATA[<?php
the_permalink_rss();
?>
]]></guid>
<description><![CDATA[<?php
if (is_single()) {
if (get_post_meta($post->ID, '_tc_post_type', true) != 'simplepost' && has_post_thumbnail()) {
the_post_thumbnail('full');
}
the_content();
} else {
echo strip_tags(get_the_excerpt());
}
?>
]]></description>
<?php
if ($thumb = tc_get_post_image($post, 'full')) {
?>
<enclosure url="<?php
echo esc_url($thumb);
?>
" length="<?php
//.........这里部分代码省略.........
示例10: bloginfo
<id><?php bloginfo('atom_url'); ?></id>
<link rel="self" type="application/atom+xml" href="<?php self_link(); ?>" />
<?php do_action('atom_head'); ?>
<?php while (have_posts()) : the_post(); ?>
<entry>
<author>
<name><?php the_author() ?></name>
<?php $author_url = get_the_author_meta('url'); if ( !empty($author_url) ) : ?>
<uri><?php the_author_meta('url')?></uri>
<?php endif; ?>
</author>
<title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
<link rel="alternate" type="text/html" href="<?php the_permalink_rss() ?>" />
<id><?php the_guid() ; ?></id>
<updated><?php echo get_post_modified_time('Y-m-d\TH:i:s\Z', true); ?></updated>
<published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
<?php the_category_rss('atom') ?>
<summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
<?php if ( !get_option('rss_use_excerpt') ) : ?>
<content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss() ?>"><![CDATA[<?php the_content_feed('atom') ?>]]></content>
<?php endif; ?>
<?php atom_enclosure(); ?>
<?php do_action('atom_entry'); ?>
<link rel="replies" type="text/html" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/>
<link rel="replies" type="application/atom+xml" href="<?php echo get_post_comments_feed_link(0,'atom') ?>" thr:count="<?php echo get_comments_number()?>"/>
<thr:total><?php echo get_comments_number()?></thr:total>
</entry>
<?php endwhile ; ?>
</feed>
示例11: wprss_addfeed_do_feed
/**
* Generate the feed
*
* @since 3.3
*/
function wprss_addfeed_do_feed($in)
{
// Prepare the post query
/*
$wprss_custom_feed_query = apply_filters(
'wprss_custom_feed_query',
array(
'post_type' => 'wprss_feed_item',
'post_status' => 'publish',
'cache_results' => false, // disable caching
)
);*/
$wprss_custom_feed_query = wprss_get_feed_items_query(apply_filters('wprss_custom_feed_query', array('get-args' => TRUE, 'no-paged' => TRUE, 'feed_limit' => 0)));
// Suppress caching
$wprss_custom_feed_query['cache_results'] = FALSE;
// Get options
$options = get_option('wprss_settings_general');
if ($options !== FALSE) {
// If options exist, get the limit
$limit = $options['custom_feed_limit'];
if ($limit !== FALSE) {
// if limit exists, set the query limit
$wprss_custom_feed_query['posts_per_page'] = $limit;
}
}
// Submit the query to get latest feed items
query_posts($wprss_custom_feed_query);
$custom_feed_title = wprss_get_general_setting('custom_feed_title');
// Send content header and start ATOM output
header('Content-Type: text/xml');
// Disabling caching
header('Cache-Control: no-cache, no-store, must-revalidate');
// HTTP 1.1.
header('Pragma: no-cache');
// HTTP 1.0.
header('Expires: 0');
// Proxies.
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" >
<title type="text"><?php
echo $custom_feed_title;
?>
</title>
<?php
// Start the Loop
while (have_posts()) {
the_post();
$permalink = get_post_meta(get_the_ID(), 'wprss_item_permalink', true);
?>
<entry>
<title><![CDATA[<?php
the_title_rss();
?>
]]></title>
<link href="<?php
echo $permalink;
?>
" />
<?php
// Enable below to link to post on our site rather than original source
?>
<!--<link href="<?php
the_permalink_rss();
?>
" />-->
<published><?php
echo get_post_time('Y-m-d\\TH:i:s\\Z');
?>
</published>
<content type="html"><![CDATA[<?php
the_content();
?>
]]></content>
<?php
do_action('wprss_custom_feed_entry', get_the_ID());
?>
</entry>
<?php
// End of the Loop
}
?>
</feed>
<?php
}
示例12: get_bloginfo_rss
<description>' . get_bloginfo_rss('description') . '</description>
<language>' . get_option('rss_language') . '</language>
<wp:wxr_version>' . WXR_VERSION . '</wp:wxr_version>
<wp:base_site_url>' . wcli_wxr_site_url() . '</wp:base_site_url>
<wp:base_blog_url>' . get_bloginfo_rss('url') . '</wp:base_blog_url>';
$output .= wpcli_wxr_authors_list();
global $wpdb;
global $wp_query;
$where = 'WHERE ID = ' . $group->ID . '';
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where}");
//Begin Loop
foreach ($posts as $post) {
setup_postdata($post);
$output .= '<item>
<title>' . apply_filters('the_title_rss', $post->post_title) . '</title>
<link>' . the_permalink_rss() . '</link>
<pubDate>' . mysql2date('D, d M Y H:i:s +0000', $post->post_date, false) . '</pubDate>
<dc:creator>' . get_the_author_meta('login') . '</dc:creator>
<guid isPermaLink="false">' . esc_url($post->guid) . '</guid>
<wp:post_id>' . $post->ID . '</wp:post_id>
<wp:post_date>' . $post->post_date . '</wp:post_date>
<wp:post_date_gmt>' . $post->post_date_gmt . '</wp:post_date_gmt>
<wp:comment_status>' . $post->comment_status . '</wp:comment_status>
<wp:ping_status>' . $post->ping_status . '</wp:ping_status>
<wp:post_name>' . $post->post_name . '</wp:post_name>
<wp:status>' . $post->post_status . '</wp:status>
<wp:post_parent>' . $post->post_parent . '</wp:post_parent>
<wp:menu_order>' . $post->menu_order . '</wp:menu_order>
<wp:post_type>' . $post->post_type . '</wp:post_type>
<wp:post_password>' . $post->post_password . '</wp:post_password>
';
示例13: export_wp
//.........这里部分代码省略.........
?>
</wp:term>
<?php
}
if ('all' == $args['post_type']) {
wxr_nav_menu_terms();
}
?>
<?php
do_action('rss2_head');
?>
<?php
$this->flush_export($full_path, false);
if ($post_ids) {
global $wp_query;
$wp_query->in_the_loop = true;
// Fake being in the loop.
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_posts = array_splice($post_ids, 0, 20)) {
$where = 'WHERE ID IN (' . join(',', $next_posts) . ')';
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where}");
// Begin Loop
foreach ($posts as $post) {
setup_postdata($post);
$is_sticky = is_sticky($post->ID) ? 1 : 0;
?>
<item>
<title><?php
echo apply_filters('the_title_rss', $post->post_title);
?>
</title>
<link><?php
the_permalink_rss();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
?>
</pubDate>
<dc:creator><?php
echo get_the_author_meta('login');
?>
</dc:creator>
<guid isPermaLink="false"><?php
esc_url(the_guid());
?>
</guid>
<description></description>
<content:encoded><?php
echo wxr_cdata(apply_filters('the_content_export', $post->post_content));
?>
</content:encoded>
<excerpt:encoded><?php
echo wxr_cdata(apply_filters('the_excerpt_export', $post->post_excerpt));
?>
</excerpt:encoded>
<wp:post_id><?php
echo $post->ID;
?>
</wp:post_id>
<wp:post_date><?php
echo $post->post_date;
?>
</wp:post_date>
<wp:post_date_gmt><?php
示例14: me_export_wp
//.........这里部分代码省略.........
bloginfo_rss('url');
?>
</wp:base_blog_url>
<?php
wxr_nav_menu_terms();
me_wxr_nav_menu_item_terms_and_posts($post_ids);
?>
<?php
do_action('rss2_head');
?>
<?php
if ($post_ids) {
global $wp_query;
$wp_query->in_the_loop = true;
// Fake being in the loop.
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_posts = array_splice($post_ids, 0, 20)) {
$where = "WHERE ID IN (" . join(',', $next_posts) . ")";
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where}");
// Begin Loop
foreach ($posts as $post) {
setup_postdata($post);
$is_sticky = is_sticky($post->ID) ? 1 : 0;
?>
<item>
<title><?php
echo apply_filters('the_title_rss', $post->post_title);
?>
</title>
<link><?php
the_permalink_rss();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
?>
</pubDate>
<dc:creator><?php
echo get_the_author_meta('login');
?>
</dc:creator>
<guid isPermaLink="false"><?php
esc_url(the_guid());
?>
</guid>
<description></description>
<content:encoded><?php
echo wxr_cdata(apply_filters('the_content_export', $post->post_content));
?>
</content:encoded>
<excerpt:encoded><?php
echo wxr_cdata(apply_filters('the_excerpt_export', $post->post_excerpt));
?>
</excerpt:encoded>
<wp:post_id><?php
echo $post->ID;
?>
</wp:post_id>
<wp:post_date><?php
echo $post->post_date;
?>
</wp:post_date>
<wp:post_date_gmt><?php
示例15: zn_export_wp
//.........这里部分代码省略.........
if ('all' == $args['content']) {
zn_wxr_nav_menu_terms();
}
?>
<?php
/** This action is documented in wp-includes/feed-rss2.php */
do_action('rss2_head');
?>
<?php
if ($post_ids) {
global $wp_query;
$wp_query->in_the_loop = true;
// Fake being in the loop.
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_posts = array_splice($post_ids, 0, 20)) {
$where = 'WHERE ID IN (' . join(',', $next_posts) . ')';
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where}");
// Begin Loop
foreach ($posts as $post) {
setup_postdata($post);
$is_sticky = is_sticky($post->ID) ? 1 : 0;
?>
<item>
<?php
/** This filter is documented in wp-includes/feed.php */
?>
<title><?php
echo apply_filters('the_title_rss', $post->post_title);
?>
</title>
<link><?php
the_permalink_rss();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
?>
</pubDate>
<dc:creator><?php
echo zn_wxr_cdata(get_the_author_meta('login'));
?>
</dc:creator>
<guid isPermaLink="false"><?php
if ($post->post_type == 'attachment' && !empty($args['replace_images'])) {
echo str_replace('wp-content/uploads/', 'zn-content/uploads/', esc_url(get_the_guid()));
} else {
the_guid();
}
?>
</guid>
<description></description>
<content:encoded><?php
/**
* Filter the post content used for WXR exports.
*
* @since 2.5.0
*
* @param string $post_content Content of the current post.
*/
echo zn_wxr_cdata(apply_filters('the_content_export', $post->post_content));
?>
</content:encoded>
<excerpt:encoded><?php
/**