本文整理汇总了PHP中wxr_term_description函数的典型用法代码示例。如果您正苦于以下问题:PHP wxr_term_description函数的具体用法?PHP wxr_term_description怎么用?PHP wxr_term_description使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxr_term_description函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export_wp
//.........这里部分代码省略.........
<?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);
?>
</wp:tag>
<?php
}
foreach ($terms as $t) {
?>
<wp:term><wp:term_id><?php
echo $t->term_id;
?>
</wp:term_id><wp:term_taxonomy><?php
echo $t->taxonomy;
?>
</wp:term_taxonomy><wp:term_slug><?php
echo $t->slug;
?>
</wp:term_slug><wp:term_parent><?php
echo $t->parent ? $terms[$t->parent]->slug : '';
?>
</wp:term_parent><?php
wxr_term_name($t);
wxr_term_description($t);
?>
</wp:term>
<?php
}
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>
示例2: export_wp
//.........这里部分代码省略.........
*
* @since 2.3.0
*
* @param object $tag Tag Object
*/
function wxr_tag_description($tag)
{
if (empty($tag->description)) {
return;
}
echo '<wp:tag_description>' . wxr_cdata($tag->description) . '</wp:tag_description>';
}
/**
* 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
*
* @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>";
示例3: export_wp
//.........这里部分代码省略.........
*
* @since unknown
*
* @param object $t Tag Object
*/
function wxr_tag_description($t)
{
if (empty($t->description)) {
return;
}
echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param object $t Term Object
*/
function wxr_term_name($t)
{
if (empty($t->name)) {
return;
}
echo '<wp:term_name>' . wxr_cdata($t->name) . '</wp:term_name>';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param object $t Term Object
*/
function wxr_term_description($t)
{
if (empty($t->description)) {
return;
}
echo '<wp:term_description>' . wxr_cdata($t->description) . '</wp:term_description>';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function wxr_post_taxonomy()
{
$categories = get_the_category();
$tags = get_the_tags();
$the_list = '';
$filter = 'rss';
if (!empty($categories)) {
foreach ((array) $categories as $category) {
$cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
// for backwards compatibility
$the_list .= "\n\t\t<category><![CDATA[{$cat_name}]]></category>\n";
// forwards compatibility: use a unique identifier for each cat to avoid clashes
// http://trac.wordpress.org/ticket/5447
$the_list .= "\n\t\t<category domain=\"category\" nicename=\"{$category->slug}\"><![CDATA[{$cat_name}]]></category>\n";
}
}
if (!empty($tags)) {
foreach ((array) $tags as $tag) {
$tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
$the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[{$tag_name}]]></category>\n";
// forwards compatibility as above
示例4: uncode_export_wp
//.........这里部分代码省略.........
*
* @since 2.3.0
*
* @param object $tag Tag Object
*/
function wxr_tag_description($tag)
{
if (empty($tag->description)) {
return;
}
echo '<wp:tag_description>' . wxr_cdata($tag->description) . '</wp:tag_description>';
}
/**
* 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";
}
}
/**
示例5: export_wp
//.........这里部分代码省略.........
*
* @since unknown
*
* @param object $t Tag Object
*/
function wxr_tag_description($t)
{
if (empty($t->description)) {
return;
}
echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param object $t Term Object
*/
function wxr_term_name($t)
{
if (empty($t->name)) {
return;
}
echo '<wp:term_name>' . wxr_cdata($t->name) . '</wp:term_name>';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param object $t Term Object
*/
function wxr_term_description($t)
{
if (empty($t->description)) {
return;
}
echo '<wp:term_description>' . wxr_cdata($t->description) . '</wp:term_description>';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function wxr_post_taxonomy()
{
$categories = get_the_category();
$tags = get_the_tags();
$the_list = '';
$filter = 'rss';
if (!empty($categories)) {
foreach ((array) $categories as $category) {
$cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
// for backwards compatibility
$the_list .= "\n\t\t<category><![CDATA[{$cat_name}]]></category>\n";
// forwards compatibility: use a unique identifier for each cat to avoid clashes
// http://trac.wordpress.org/ticket/5447
$the_list .= "\n\t\t<category domain=\"category\" nicename=\"{$category->slug}\"><![CDATA[{$cat_name}]]></category>\n";
}
}
if (!empty($tags)) {
foreach ((array) $tags as $tag) {
$tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
$the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[{$tag_name}]]></category>\n";
// forwards compatibility as above
示例6: export_wp
//.........这里部分代码省略.........
*
* @since 2.3.0
*
* @param object $tag Tag Object
*/
function wxr_tag_description($tag)
{
if (empty($tag->description)) {
return;
}
echo '<wp:tag_description>' . wxr_cdata($tag->description) . '</wp:tag_description>';
}
/**
* 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";
}
}
/**