本文整理汇总了PHP中wxr_authors_list函数的典型用法代码示例。如果您正苦于以下问题:PHP wxr_authors_list函数的具体用法?PHP wxr_authors_list怎么用?PHP wxr_authors_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxr_authors_list函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export_wp
//.........这里部分代码省略.........
bloginfo_rss('name');
?>
</title>
<link><?php
bloginfo_rss('url');
?>
</link>
<description><?php
bloginfo_rss('description');
?>
</description>
<pubDate><?php
echo date('D, d M Y H:i:s +0000');
?>
</pubDate>
<language><?php
echo get_option('rss_language');
?>
</language>
<wp:wxr_version><?php
echo WXR_VERSION;
?>
</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
wxr_authors_list();
?>
<?php
foreach ($cats as $c) {
?>
<wp:category><wp:term_id><?php
echo $c->term_id;
?>
</wp:term_id><wp:category_nicename><?php
echo $c->slug;
?>
</wp:category_nicename><wp:category_parent><?php
echo $c->parent ? $cats[$c->parent]->slug : '';
?>
</wp:category_parent><?php
wxr_cat_name($c);
wxr_category_description($c);
?>
</wp:category>
<?php
}
foreach ($tags as $t) {
?>
<wp:tag><wp:term_id><?php
echo $t->term_id;
?>
</wp:term_id><wp:tag_slug><?php
echo $t->slug;
?>
</wp:tag_slug><?php
wxr_tag_name($t);
wxr_tag_description($t);
示例2: export_wp
//.........这里部分代码省略.........
*
* @param object $term Term Object
*/
function wxr_term_name($term)
{
if (empty($term->name)) {
return;
}
echo '<wp:term_name>' . wxr_cdata($term->name) . '</wp:term_name>';
}
/**
* Output a term_description XML tag from a given term object
*
* @since 2.9.0
*
* @param object $term Term Object
*/
function wxr_term_description($term)
{
if (empty($term->description)) {
return;
}
echo '<wp:term_description>' . wxr_cdata($term->description) . '</wp:term_description>';
}
/**
* Output list of authors with posts
*
* @since 3.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param array $post_ids Array of post IDs to filter the query by. Optional.
*/
function wxr_authors_list(array $post_ids = null)
{
global $wpdb;
if (!empty($post_ids)) {
$post_ids = array_map('absint', $post_ids);
$and = 'AND ID IN ( ' . implode(', ', $post_ids) . ')';
} else {
$and = '';
}
$authors = array();
$results = $wpdb->get_results("SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_status != 'auto-draft' {$and}");
foreach ((array) $results as $result) {
$authors[] = get_userdata($result->post_author);
}
$authors = array_filter($authors);
foreach ($authors as $author) {
echo "\t<wp:author>";
echo '<wp:author_id>' . intval($author->ID) . '</wp:author_id>';
echo '<wp:author_login>' . wxr_cdata($author->user_login) . '</wp:author_login>';
echo '<wp:author_email>' . wxr_cdata($author->user_email) . '</wp:author_email>';
echo '<wp:author_display_name>' . wxr_cdata($author->display_name) . '</wp:author_display_name>';
echo '<wp:author_first_name>' . wxr_cdata($author->first_name) . '</wp:author_first_name>';
echo '<wp:author_last_name>' . wxr_cdata($author->last_name) . '</wp:author_last_name>';
echo "</wp:author>\n";
}
}
/**
* Ouput all navigation menu terms
*
* @since 3.1.0
*/
function wxr_nav_menu_terms()
{
示例3: uncode_export_wp
//.........这里部分代码省略.........
/**
* Output a term_name XML tag from a given term object
*
* @since 2.9.0
*
* @param object $term Term Object
*/
function wxr_term_name($term)
{
if (empty($term->name)) {
return;
}
echo '<wp:term_name>' . wxr_cdata($term->name) . '</wp:term_name>';
}
/**
* Output a term_description XML tag from a given term object
*
* @since 2.9.0
*
* @param object $term Term Object
*/
function wxr_term_description($term)
{
if (empty($term->description)) {
return;
}
echo '<wp:term_description>' . wxr_cdata($term->description) . '</wp:term_description>';
}
/**
* Output list of authors with posts
*
* @since 3.1.0
*/
function wxr_authors_list()
{
global $wpdb;
$authors = array();
$results = $wpdb->get_results("SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_status != 'auto-draft'");
foreach ((array) $results as $result) {
$authors[] = get_userdata($result->post_author);
}
$authors = array_filter($authors);
foreach ($authors as $author) {
echo "\t<wp:author>";
echo '<wp:author_id>' . $author->ID . '</wp:author_id>';
echo '<wp:author_login>' . $author->user_login . '</wp:author_login>';
echo '<wp:author_email>' . $author->user_email . '</wp:author_email>';
echo '<wp:author_display_name>' . wxr_cdata($author->display_name) . '</wp:author_display_name>';
echo '<wp:author_first_name>' . wxr_cdata($author->user_firstname) . '</wp:author_first_name>';
echo '<wp:author_last_name>' . wxr_cdata($author->user_lastname) . '</wp:author_last_name>';
echo "</wp:author>\n";
}
}
/**
* Ouput all navigation menu terms
*
* @since 3.1.0
*/
function wxr_nav_menu_terms()
{
$nav_menus = wp_get_nav_menus();
if (empty($nav_menus) || !is_array($nav_menus)) {
return;
}
foreach ($nav_menus as $menu) {
echo "\t<wp:term><wp:term_id>{$menu->term_id}</wp:term_id><wp:term_taxonomy>nav_menu</wp:term_taxonomy><wp:term_slug>{$menu->slug}</wp:term_slug>";
示例4: wxr_site_url
?>
</language>
<wp:wxr_version><?php
echo WXR_VERSION;
?>
</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
wxr_authors_list();
if ($my_options['acf_posts']) {
global $wp_query, $wpdb, $post;
$wp_query->in_the_loop = true;
// Fake being in the loop.
// create SQL with %d placeholders
$where = 'WHERE ID IN (' . substr(str_repeat('%d,', count($my_options['acf_posts'])), 0, -1) . ')';
// now prepare the SQL based on the %d + $_POST data
$posts = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->posts} {$where}", $my_options['acf_posts']));
// Begin Loop
foreach ($posts as $post) {
setup_postdata($post);
?>
<item>
<link><?php
the_permalink_rss();
示例5: export_wp
//.........这里部分代码省略.........
/**
* Output a term_name XML tag from a given term object
*
* @since 2.9.0
*
* @param object $term Term Object
*/
function wxr_term_name($term)
{
if (empty($term->name)) {
return;
}
echo '<wp:term_name>' . wxr_cdata($term->name) . '</wp:term_name>';
}
/**
* Output a term_description XML tag from a given term object
*
* @since 2.9.0
*
* @param object $term Term Object
*/
function wxr_term_description($term)
{
if (empty($term->description)) {
return;
}
echo '<wp:term_description>' . wxr_cdata($term->description) . '</wp:term_description>';
}
/**
* Output list of authors with posts
*
* @since 3.1.0
*/
function wxr_authors_list()
{
global $wpdb;
$authors = array();
$results = $wpdb->get_results("SELECT DISTINCT post_author FROM {$wpdb->posts}");
foreach ((array) $results as $result) {
$authors[] = get_userdata($result->post_author);
}
$authors = array_filter($authors);
foreach ($authors as $author) {
echo "\t<wp:author>";
echo '<wp:author_id>' . $author->ID . '</wp:author_id>';
echo '<wp:author_login>' . $author->user_login . '</wp:author_login>';
echo '<wp:author_email>' . $author->user_email . '</wp:author_email>';
echo '<wp:author_display_name>' . wxr_cdata($author->display_name) . '</wp:author_display_name>';
echo '<wp:author_first_name>' . wxr_cdata($author->user_firstname) . '</wp:author_first_name>';
echo '<wp:author_last_name>' . wxr_cdata($author->user_lastname) . '</wp:author_last_name>';
echo "</wp:author>\n";
}
}
/**
* Ouput all navigation menu terms
*
* @since 3.1.0
*/
function wxr_nav_menu_terms()
{
$nav_menus = wp_get_nav_menus();
if (empty($nav_menus) || !is_array($nav_menus)) {
return;
}
foreach ($nav_menus as $menu) {
echo "\t<wp:term><wp:term_id>{$menu->term_id}</wp:term_id><wp:term_taxonomy>nav_menu</wp:term_taxonomy><wp:term_slug>{$menu->slug}</wp:term_slug>";