本文整理汇总了PHP中get_lastpostdate函数的典型用法代码示例。如果您正苦于以下问题:PHP get_lastpostdate函数的具体用法?PHP get_lastpostdate怎么用?PHP get_lastpostdate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_lastpostdate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test_add_to_index
/**
* @covers WPSEO_News_Sitemap::add_to_index
*/
public function test_add_to_index()
{
$output = $this->instance->add_to_index('');
$output_date = new DateTime(get_lastpostdate('gmt'), new DateTimeZone(new WPSEO_News_Sitemap_Timezone()));
$expected_output = '<sitemap>' . "\n";
$expected_output .= '<loc>' . home_url('news-sitemap.xml') . '</loc>' . "\n";
$expected_output .= '<lastmod>' . htmlspecialchars($output_date->format('c')) . '</lastmod>' . "\n";
$expected_output .= '</sitemap>' . "\n";
$this->assertEquals($expected_output, $output);
}
开发者ID:nova-sm,项目名称:wpseo-news,代码行数:13,代码来源:test-class-sitemap.php
示例2: add_to_index
/**
* Add the XML News Sitemap to the Sitemap Index.
*
* @param string $str String with Index sitemap content.
*
* @return string
*/
public function add_to_index($str)
{
$date = new DateTime(get_lastpostdate('gmt'), new DateTimeZone(new WPSEO_News_Sitemap_Timezone()));
/**
* Filter: 'wpseo_news_sitemap_name' - Allow filtering the news sitemap XML URL
*
* @api string $news_sitemap_xml The news sitemap XML URL
*/
$news_sitemap_xml = WPSEO_News::get_sitemap_name();
$str .= '<sitemap>' . "\n";
$str .= '<loc>' . $news_sitemap_xml . '</loc>' . "\n";
$str .= '<lastmod>' . htmlspecialchars($date->format('c')) . '</lastmod>' . "\n";
$str .= '</sitemap>' . "\n";
return $str;
}
开发者ID:nova-sm,项目名称:wpseo-news,代码行数:22,代码来源:class-sitemap.php
示例3: SendPingDaily
/**
* Handles daily ping
*/
public function SendPingDaily()
{
$this->LoadOptions();
$blogUpdate = strtotime(get_lastpostdate('blog'));
$lastPing = $this->GetOption('i_lastping');
$yesterday = time() - 60 * 60 * 24;
if ($blogUpdate >= $yesterday && ($lastPing == 0 || $lastPing <= $yesterday)) {
$this->SendPing();
}
if ($this->GetOption('b_stats')) {
$this->SendStats();
}
}
开发者ID:rossbruniges,项目名称:content.thecssdiv.co.uk,代码行数:16,代码来源:sitemap-core.php
示例4: get_feed
function get_feed($page = 1, $post_type = 'post')
{
global $post, $wp, $wp_query, $posts, $wpdb, $blog_id;
log_app('function', "get_feed({$page}, '{$post_type}')");
ob_start();
if (!isset($page)) {
$page = 1;
}
$page = (int) $page;
$count = get_option('posts_per_rss');
wp('what_to_show=posts&posts_per_page=' . $count . '&offset=' . ($count * ($page - 1) . '&orderby=modified'));
$post = $GLOBALS['post'];
$posts = $GLOBALS['posts'];
$wp = $GLOBALS['wp'];
$wp_query = $GLOBALS['wp_query'];
$wpdb = $GLOBALS['wpdb'];
$blog_id = (int) $GLOBALS['blog_id'];
log_app('function', "query_posts(# " . print_r($wp_query, true) . "#)");
log_app('function', "total_count(# {$wp_query->max_num_pages} #)");
$last_page = $wp_query->max_num_pages;
$next_page = $page + 1 > $last_page ? NULL : $page + 1;
$prev_page = $page - 1 < 1 ? NULL : $page - 1;
$last_page = (int) $last_page == 1 || (int) $last_page == 0 ? NULL : (int) $last_page;
$self_page = $page > 1 ? $page : NULL;
?>
<feed xmlns="<?php
echo $this->ATOM_NS;
?>
" xmlns:app="<?php
echo $this->ATOMPUB_NS;
?>
" xml:lang="<?php
echo get_option('rss_language');
?>
">
<id><?php
$this->the_entries_url();
?>
</id>
<updated><?php
echo mysql2date('Y-m-d\\TH:i:s\\Z', get_lastpostmodified('GMT'));
?>
</updated>
<title type="text"><?php
bloginfo_rss('name');
?>
</title>
<subtitle type="text"><?php
bloginfo_rss("description");
?>
</subtitle>
<link rel="first" type="<?php
echo $this->ATOM_CONTENT_TYPE;
?>
" href="<?php
$this->the_entries_url();
?>
" />
<?php
if (isset($prev_page)) {
?>
<link rel="previous" type="<?php
echo $this->ATOM_CONTENT_TYPE;
?>
" href="<?php
$this->the_entries_url($prev_page);
?>
" />
<?php
}
if (isset($next_page)) {
?>
<link rel="next" type="<?php
echo $this->ATOM_CONTENT_TYPE;
?>
" href="<?php
$this->the_entries_url($next_page);
?>
" />
<?php
}
?>
<link rel="last" type="<?php
echo $this->ATOM_CONTENT_TYPE;
?>
" href="<?php
$this->the_entries_url($last_page);
?>
" />
<link rel="self" type="<?php
echo $this->ATOM_CONTENT_TYPE;
?>
" href="<?php
$this->the_entries_url($self_page);
?>
" />
<rights type="text">Copyright <?php
echo mysql2date('Y', get_lastpostdate('blog'));
?>
</rights>
//.........这里部分代码省略.........
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:101,代码来源:wp-app.php
示例5: SendPingDaily
/**
* Handles daily ping
*/
public function SendPingDaily()
{
$this->LoadOptions();
$blogUpdate = strtotime(get_lastpostdate('blog'));
$lastPing = $this->GetOption('i_lastping');
$yesterday = time() - 60 * 60 * 24;
if ($blogUpdate >= $yesterday && ($lastPing == 0 || $lastPing <= $yesterday)) {
$this->SendPing();
}
//Send statistics if enabled (disabled by default)
if ($this->GetOption('b_stats')) {
$this->SendStats();
}
//Cache the support feed so there is no delay when loading the user interface
if ($this->GetOption('i_supportfeed')) {
$last = $this->GetOption('i_supportfeed_cache');
if ($last <= time() - $this->GetSupportFeedCacheLifetime()) {
$supportFeed = $this->GetSupportFeed();
if (!is_wp_error($supportFeed) && $supportFeed) {
$this->SetOption('i_supportfeed_cache', time());
$this->SaveOptions();
}
}
}
}
开发者ID:yarwalker,项目名称:ecobyt,代码行数:28,代码来源:sitemap-core.php
示例6: get_lastpostmodified
/**
* Get the timestamp of the last time any post was modified.
*
* The server timezone is the default and is the difference between GMT and
* server time. The 'blog' value is just when the last post was modified. The
* 'gmt' is when the last post was modified in GMT time.
*
* @since 1.2.0
* @since 4.4.0 The `$post_type` argument was added.
*
* @param string $timezone Optional. The timezone for the timestamp. See {@see get_lastpostdate()}
* for information on accepted values.
* Default 'server'.
* @param string $post_type Optional. The post type to check. Default 'any'.
* @return string The timestamp.
*/
function get_lastpostmodified($timezone = 'server', $post_type = 'any')
{
/**
* Pre-filter the return value of get_lastpostmodified() before the query is run.
*
* @since 4.4.0
*
* @param string $lastpostmodified Date the last post was modified.
* Returning anything other than false will short-circuit the function.
* @param string $timezone Location to use for getting the post modified date.
* See {@see get_lastpostdate()} for accepted `$timezone` values.
* @param string $post_type The post type to check.
*/
$lastpostmodified = apply_filters('pre_get_lastpostmodified', false, $timezone, $post_type);
if (false !== $lastpostmodified) {
return $lastpostmodified;
}
$lastpostmodified = _get_last_post_time($timezone, 'modified', $post_type);
$lastpostdate = get_lastpostdate($timezone);
if ($lastpostdate > $lastpostmodified) {
$lastpostmodified = $lastpostdate;
}
/**
* Filter the date the last post was modified.
*
* @since 2.3.0
*
* @param string $lastpostmodified Date the last post was modified.
* @param string $timezone Location to use for getting the post modified date.
* See {@see get_lastpostdate()} for accepted `$timezone` values.
*/
return apply_filters('get_lastpostmodified', $lastpostmodified, $timezone);
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:49,代码来源:post.php
示例7: header
header('Content-type: application/atom+xml; charset=' . get_settings('blog_charset'), true);
$more = 1;
?>
<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>
<feed version="0.3"
xmlns="http://purl.org/atom/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xml:lang="<?php echo get_option('rss_language'); ?>"
>
<title><?php bloginfo_rss('name') ?></title>
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
<tagline><?php bloginfo_rss("description") ?></tagline>
<modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></modified>
<copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></copyright>
<generator url="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
<entry>
<author>
<name><?php the_author() ?></name>
</author>
<title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title>
<link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
<id><?php the_guid(); ?></id>
<modified><?php the_time('Y-m-d\TH:i:s\Z'); ?></modified>
<issued> <?php the_time('Y-m-d\TH:i:s\Z'); ?></issued>
<?php the_category_rss('rdf') ?>
<summary type="<?php bloginfo('html_type'); ?>" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
<?php if (!get_settings('rss_use_excerpt')) : ?>
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:30,代码来源:wp-atom.php
示例8: header
<?php
include 'includes/connection.php';
require './wp-blog-header.php';
header("Content-type: text/xml");
header('HTTP/1.1 200 OK');
$posts_to_show = 1000;
// 获取文章数量
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<?xml-stylesheet type="text/xsl" href="/sitemap.xsl"?>';
// XSL地址
echo '<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">';
?>
<!-- generated-on=<?php
echo get_lastpostdate('blog');
?>
Modified Gimhoy(http://blog.gimhoy.com)-->
<url>
<loc><?php
echo get_home_url();
?>
</loc>
<lastmod><?php
$ltime = get_lastpostmodified(GMT);
$ltime = gmdate('Y-m-d\\TH:i:s+00:00', strtotime($ltime));
echo $ltime;
?>
</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
开发者ID:houzhenggang,项目名称:WordPress-on-BAE,代码行数:31,代码来源:sitemap.php
示例9: get_lastpostmodified
function get_lastpostmodified($timezone = 'server') {
global $cache_lastpostmodified, $pagenow, $wpdb;
$add_seconds_blog = get_settings('gmt_offset') * 3600;
$add_seconds_server = date('Z');
$now = current_time('mysql', 1);
if ( !isset($cache_lastpostmodified[$timezone]) ) {
switch(strtolower($timezone)) {
case 'gmt':
$lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
case 'blog':
$lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
case 'server':
$lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
}
$lastpostdate = get_lastpostdate($timezone);
if ( $lastpostdate > $lastpostmodified ) {
$lastpostmodified = $lastpostdate;
}
$cache_lastpostmodified[$timezone] = $lastpostmodified;
} else {
$lastpostmodified = $cache_lastpostmodified[$timezone];
}
return $lastpostmodified;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:27,代码来源:functions.php
示例10: get_lastpostmodified
function get_lastpostmodified()
{
static $cache_lastpostmodified;
if (!isset($cache_lastpostmodified[wp_id()]) || !$GLOBALS['use_cache']) {
$criteria =& new CriteriaCompo(new Criteria('post_date', current_time('mysql'), "<="));
$criteria->add(new Criteria('post_status', 'publish'));
$criteria->setSort('post_modified');
$criteria->setOrder('DESC');
$criteria->setLimit(1);
$postHandler =& wp_handler('Post');
$postObjects =& $postHandler->getObjects($criteria, false, 'post_modified');
$lastpostmodified = $postObjects[0]->getVar('post_modified');
$lastpostdate = get_lastpostdate();
if ($lastpostmodified < $lastpostdate) {
$cache_lastpostmodified[wp_id()] = $lastpostmodified = $lastpostdate;
} else {
$cache_lastpostmodified[wp_id()] = $lastpostmodified;
}
} else {
$lastpostmodified = $GLOBALS['lastpostmodified'][wp_id()];
}
return $lastpostmodified;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:23,代码来源:functions.php
示例11: bloginfo
echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
?>
"/>
<link rel="alternate" type="<?php
bloginfo('html_type');
?>
" href="<?php
bloginfo_rss('home');
?>
/"/>
<updated><?php
echo mysql2date('Y-m-d\\TH:i:s\\Z', get_lastpostmodified('GMT'), false);
?>
</updated>
<rights>Copyright <?php
echo mysql2date('Y', get_lastpostdate('blog'), 0);
?>
</rights>
<generator uri="http://wordpress.org/" version="<?php
bloginfo_rss('version');
?>
">WordPress</generator>
<?php
do_action('atom_head');
$items_count = 0;
if ($posts) {
foreach ($posts as $post) {
start_wp();
?>
<entry>
<title type="html"><![CDATA[ <?php
开发者ID:profesoru,项目名称:wp2blogger,代码行数:31,代码来源:wp-gdata-2.0.x.php
示例12: get_last_post_date
function get_last_post_date()
{
$ret = array();
// get_lastpostdate built in function retrieves date for whatever post type while we
// want posts not to break the archive display
// if no posts are available we use get_lastpostdate to prevent interpreter to throw errors
// and we expect a 404 page in FE
$args = array('posts_per_page' => 1, 'offset' => 0, 'category' => '', 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_mime_type' => '', 'post_parent' => '', 'post_status' => array('publish', 'private'), 'suppress_filters' => false);
$posts = get_posts($args);
if ($posts && isset($posts[0])) {
$date = $posts[0]->post_date;
} else {
$date = get_lastpostdate('blog');
}
$lastpost = strtotime($date);
$ret['year'] = date('Y', $lastpost);
$ret['month'] = date('m', $lastpost);
$ret['day'] = date('d', $lastpost);
return (object) $ret;
}
开发者ID:javierdlahoz,项目名称:paella-development,代码行数:20,代码来源:wpddl.archives.manager.class.php
示例13: bloginfo_rss
<subtitle type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<strong><?php
bloginfo_rss('description');
?>
</strong><br /><br />
Insert more <strong>info</strong> about your blog here.
</div>
</subtitle>
<updated><?php
echo mysql2date('Y-m-d\\TH:i:s\\Z', get_lastpostmodified('gmt'), false);
?>
</updated>
<rights>Copyright <?php
echo mysql2date('Y', get_lastpostdate('gmt'), false);
?>
<?php
bloginfo_rss('name');
?>
</rights>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
<generator uri="http://wordpress.org/" version="<?php
bloginfo_rss('version');
?>
">WordPress</generator>
<author>
<name><?php
bloginfo_rss('name');
?>
开发者ID:cracknel,项目名称:ubuntudanmark.dk,代码行数:31,代码来源:wp-atom.php
示例14: mysql2date
$lastpostdate = mysql2date('U', $lastpostdate);
$otherdate = date('Y-m-d H:i:s', $lastpostdate - ($posts_per_page - 1) * 86400);
$where .= ' AND post_date > \'' . $otherdate . '\'';
}
}
if (!empty($postend) && $postend > $poststart && !$m && empty($monthnum) && empty($year) && empty($day) && !$w && !$whichcat && !$s && !$p) {
if ($what_to_show == 'posts' || $what_to_show == 'paged' && !$paged) {
$poststart = intval($poststart);
$postend = intval($postend);
$limposts = $postend - $poststart;
$limits = ' LIMIT ' . $poststart . ',' . $limposts;
} elseif ($what_to_show == 'days') {
$poststart = intval($poststart);
$postend = intval($postend);
$limposts = $postend - $poststart;
$lastpostdate = get_lastpostdate();
$lastpostdate = mysql2date('Y-m-d 00:00:00', $lastpostdate);
$lastpostdate = mysql2date('U', $lastpostdate);
$startdate = date('Y-m-d H:i:s', $lastpostdate - ($poststart - 1) * 86400);
$otherdate = date('Y-m-d H:i:s', $lastpostdate - ($postend - 1) * 86400);
$where .= ' AND post_date > \'' . $otherdate . '\' AND post_date < \'' . $startdate . '\'';
}
} else {
if ($what_to_show == 'paged' && !$p && !$more) {
if ($pagenow != 'post.php') {
$pgstrt = '';
if ($paged) {
$pgstrt = (intval($paged) - 1) * $posts_per_page . ', ';
}
$limits = 'LIMIT ' . $pgstrt . $posts_per_page;
} else {
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-blog-header.php
示例15: mysql2date
$_lastpostdate = mysql2date('U', $_lastpostdate);
$_otherdate = date('Y-m-d H:i:s', $_lastpostdate - ($GLOBALS['posts_per_page'] - 1) * 86400);
$_criteria->add(new Criteria('post_date', $_otherdate, '>'));
}
}
if (test_param('postend') && get_param('postend') > get_param('poststart') && !test_param('m') && !test_param('monthnum') && !test_param('year') && !test_param('day') && !test_param('w') && !test_param('cat') && !test_param('category_name') && !test_param('s') && !test_param('p')) {
if ($GLOBALS['what_to_show'] == 'posts' || $GLOBALS['what_to_show'] == 'paged' && !test_param('paged')) {
$_poststart = intval(get_param('poststart'));
$_postend = intval(get_param('postend'));
$_criteria_limit = $_postend - $_poststart;
$_criteria_start = $_poststart;
} elseif ($GLOBALS['what_to_show'] == 'days') {
$_poststart = intval(get_param('poststart'));
$_postend = intval(get_param('postend'));
$_limposts = $_postend - $_poststart;
$_lastpostdate = mysql2date('Y-m-d 00:00:00', get_lastpostdate());
$_lastpostdate = mysql2date('U', $_lastpostdate);
$_startdate = date('Y-m-d H:i:s', $_lastpostdate - ($_poststart - 1) * 86400);
$_otherdate = date('Y-m-d H:i:s', $_lastpostdate - ($_postend - 1) * 86400);
$_criteria->add(new Criteria('post_date', $_startdate, '<'));
$_criteria->add(new Criteria('post_date', $_otherdate, '>'));
}
} else {
if ($GLOBALS['what_to_show'] == 'paged' && !test_param('p') && !test_param('more')) {
if ($GLOBALS['pagenow'] != 'post.php') {
if (test_param('paged')) {
$_criteria_start = (intval(get_param('paged')) - 1) * $GLOBALS['posts_per_page'];
}
$_criteria_limit = $GLOBALS['posts_per_page'];
} else {
if (test_param('m') || test_param('p') || test_param('w') || test_param('s') || test_param('cat') || test_param('category_name')) {
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-blog-header.php
示例16: get_lastpostmodified
/**
* get_lastpostmodified() - {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @package WordPress
* @subpackage Post
* @since 1.2
*
* @uses $wpdb
* @uses $blog_id
* @uses apply_filters() Calls 'get_lastpostmodified' filter
*
* @global mixed $cache_lastpostmodified Stores the date the last post was modified
* @global mixed $pagenow The current page being viewed
*
* @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
* @return string The date the post was last modified.
*/
function get_lastpostmodified($timezone = 'server')
{
global $cache_lastpostmodified, $wpdb, $blog_id;
$add_seconds_server = date('Z');
if (!isset($cache_lastpostmodified[$blog_id][$timezone])) {
switch (strtolower($timezone)) {
case 'gmt':
$lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM {$wpdb->posts} WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
case 'blog':
$lastpostmodified = $wpdb->get_var("SELECT post_modified FROM {$wpdb->posts} WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
case 'server':
$lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '{$add_seconds_server}' SECOND) FROM {$wpdb->posts} WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
}
$lastpostdate = get_lastpostdate($timezone);
if ($lastpostdate > $lastpostmodified) {
$lastpostmodified = $lastpostdate;
}
$cache_lastpostmodified[$blog_id][$timezone] = $lastpostmodified;
} else {
$lastpostmodified = $cache_lastpostmodified[$blog_id][$timezone];
}
return apply_filters('get_lastpostmodified', $lastpostmodified, $timezone);
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:45,代码来源:post.php
示例17: Index
/**
* @param $gsg GoogleSitemapGenerator
*/
public function Index($gsg)
{
global $wpdb, $wp_version;
$blogUpdate = strtotime(get_lastpostdate('blog'));
$gsg->AddSitemap("misc", null, $blogUpdate);
if ($gsg->GetOption("in_arch")) {
$gsg->AddSitemap("archives", null, $blogUpdate);
}
if ($gsg->GetOption("in_auth")) {
$gsg->AddSitemap("authors", null, $blogUpdate);
}
$taxonomies = $this->GetEnabledTaxonomies($gsg);
foreach ($taxonomies as $tax) {
$gsg->AddSitemap("tax", $tax);
}
$pages = $gsg->GetPages();
if (count($pages) > 0) {
$gsg->AddSitemap("externals", null, $blogUpdate);
}
$enabledPostTypes = $gsg->GetActivePostTypes();
if (count($enabledPostTypes) > 0) {
//Add filter to remove password protected posts
add_filter('posts_search', array($this, 'FilterPassword'), 10, 2);
//Add filter to remove fields
add_filter('posts_fields', array($this, 'FilterIndexFields'), 10, 2);
//Add filter to group
add_filter('posts_groupby', array($this, 'FilterIndexGroup'), 10, 2);
foreach ($enabledPostTypes as $postType) {
$qp = $this->BuildPostQuery($gsg, $postType);
$qp['cache_results'] = false;
$posts = @get_posts($qp);
if ($posts) {
foreach ($posts as $post) {
$gsg->AddSitemap("pt", $postType . "-" . sprintf("%04d-%02d", $post->year, $post->month), $gsg->GetTimestampFromMySql($post->last_mod));
}
}
}
//Remove the filters again
remove_filter('posts_where', array($this, 'FilterPassword'), 10, 2);
remove_filter('posts_fields', array($this, 'FilterIndexFields'), 10, 2);
remove_filter('posts_groupby', array($this, 'FilterIndexGroup'), 10, 2);
}
}
开发者ID:ryanurban,项目名称:Orbit,代码行数:46,代码来源:sitemap-builder.php
示例18: get_lastpostmodified
/**
* Retrieve last post modified date depending on timezone.
*
* The server timezone is the default and is the difference between GMT and
* server time. The 'blog' value is just when the last post was modified. The
* 'gmt' is when the last post was modified in GMT time.
*
* @since 1.2.0
* @uses $wpdb
* @uses $blog_id
* @uses apply_filters() Calls 'get_lastpostmodified' filter
*
* @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
* @return string The date the post was last modified.
*/
function get_lastpostmodified($timezone = 'server')
{
global $wpdb;
$add_seconds_server = date('Z');
$timezone = strtolower($timezone);
$lastpostmodified = wp_cache_get("lastpostmodified:{$timezone}", 'timeinfo');
if ($lastpostmodified) {
return apply_filters('get_lastpostmodified', $lastpostmodified, $timezone);
}
switch (strtolower($timezone)) {
case 'gmt':
$lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
case 'blog':
$lastpostmodified = $wpdb->get_var("SELECT post_modified FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
case 'server':
$lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '{$add_seconds_server}' SECOND) FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
break;
}
$lastpostdate = get_lastpostdate($timezone);
if ($lastpostdate > $lastpostmodified) {
$lastpostmodified = $lastpostdate;
}
if ($lastpostmodified) {
wp_cache_set("lastpostmodified:{$timezone}", $lastpostmodified, 'timeinfo');
}
return apply_filters('get_lastpostmodified', $lastpostmodified, $timezone);
}
开发者ID:owaismeo,项目名称:wordpress-10,代码行数:44,代码来源:post.php
示例19: bloginfo_rss
?>
</title>
<link><?php
bloginfo_rss('url');
?>
</link>
<description><?php
bloginfo_rss('description');
?>
</description>
<language><?php
echo get_settings('rss_language') ? get_settings('rss_language') : 'en';
?>
</language>
<copyright>Copyright <?php
echo mysql2date('Y', get_lastpostdate());
?>
</copyright>
<pubDate><?php
echo gmdate('r');
?>
</pubDate>
<generator>http://wordpress.xwd.jp/?v=<?php
echo $GLOBALS['wp_version'];
?>
</generator>
<?php
if ($GLOBALS['posts']) {
foreach ($GLOBALS['posts'] as $GLOBALS['post']) {
start_wp();
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-rss2.php
示例20: get_lastpostmodified
/**
* Get the timestamp of the last time any post was modified.
*
* The server timezone is the default and is the difference between GMT and
* server time. The 'blog' value is just when the last post was modified. The
* 'gmt' is when the last post was modified in GMT time.
*
* @since 1.2.0
*
* @param string $timezone Optional. The timezone for the timestamp. Uses the server's internal timezone.
* Accepts 'server', 'blog', 'gmt'. or 'server'. 'server' uses the server's
* internal timezone. 'blog' uses the `post_modified` field, which proxies
* to the timezone set for the site. 'gmt' uses the `post_modified_gmt` field.
* Default 'server'.
* @return string The timestamp.
*/
function get_lastpostmodified($timezone = 'server')
{
$lastpostmodified = _get_last_post_time($timezone, 'modified');
$lastpostdate = get_lastpostdate($timezone);
if ($lastpostdate > $lastpostmodified) {
$lastpostmodified = $lastpostdate;
}
/**
* Filter the date the last post was modified.
*
* @since 2.3.0
*
* @param string $lastpostmodified Date the last post was modified.
* @param string $timezone Location to use for getting the post modified date.
* See {@see get_lastpostmodified()} for accepted `$timezone` values.
*/
return apply_filters('get_lastpostmodified', $lastpostmodified, $timezone);
}
开发者ID:venizeng,项目名称:pintimes-wordpress,代码行数:34,代码来源:post.php
注:本文中的get_lastpostdate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论