• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_post_type_archive_feed_link函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: handleChange

 /**
  * Triggers on a change event and adds the relevant URL's to the ban list
  *
  * Function inspired by Varnish HTTP Purge
  * https://github.com/Ipstenu/varnish-http-purge/blob/master/plugin/varnish-http-purge.php#L277
  *
  * @param  [type] $postId [description]
  * @return [type]         [description]
  */
 protected function handleChange($postId)
 {
     // If this is a valid post we want to purge the post, the home page and any associated tags & cats
     // If not, purge everything on the site.
     $validPostStatus = array("publish", "trash");
     $thisPostStatus = get_post_status($postId);
     // If this is a revision, stop.
     if (get_permalink($postId) !== true && !in_array($thisPostStatus, $validPostStatus)) {
         return;
     } else {
         // array to collect all our URLs
         $listofurls = array();
         // Category purge based on Donnacha's work in WP Super Cache
         $categories = get_the_category($postId);
         if ($categories) {
             foreach ($categories as $cat) {
                 $this->invalidateUrl(get_category_link($cat->term_id));
             }
         }
         // Tag purge based on Donnacha's work in WP Super Cache
         $tags = get_the_tags($postId);
         if ($tags) {
             foreach ($tags as $tag) {
                 $this->invalidateUrl(get_tag_link($tag->term_id));
             }
         }
         // Author URL
         $this->invalidateUrl(get_author_posts_url(get_post_field('post_author', $postId)));
         $this->invalidateUrl(get_author_feed_link(get_post_field('post_author', $postId)));
         // Archives and their feeds
         $archiveurls = array();
         if (get_post_type_archive_link(get_post_type($postId)) == true) {
             $this->invalidateUrl(get_post_type_archive_link(get_post_type($postId)));
             $this->invalidateUrl(get_post_type_archive_feed_link(get_post_type($postId)));
         }
         // Post URL
         $this->invalidateUrl(get_permalink($postId));
         // Feeds
         $this->invalidateUrl(get_bloginfo_rss('rdf_url'));
         $this->invalidateUrl(get_bloginfo_rss('rss_url'));
         $this->invalidateUrl(get_bloginfo_rss('rss2_url'));
         $this->invalidateUrl(get_bloginfo_rss('atom_url'));
         $this->invalidateUrl(get_bloginfo_rss('comments_rss2_url'));
         $this->invalidateUrl(get_post_comments_feed_link($postId));
         // Home Page and (if used) posts page
         $this->invalidateUrl(home_url('/'));
         if (get_option('show_on_front') == 'page') {
             $this->invalidateUrl(get_permalink(get_option('page_for_posts')));
         }
     }
     // Filter to add or remove urls to the array of purged urls
     // @param array $purgeUrls the urls (paths) to be purged
     // @param int $postId the id of the new/edited post
     // $this->invalidateUrls = apply_filters( 'vhp_purge_urls', $this->invalidateUrls, $postId );
 }
开发者ID:Rareloop,项目名称:wp-varnish-invalidator,代码行数:64,代码来源:VarnishInvalidator.php


示例2: ph_properties_rss_feed

/**
 * Properties RSS Feed.
 *
 * @access public
 * @return void
 */
function ph_properties_rss_feed()
{
    // Property RSS
    if (is_post_type_archive('property') || is_singular('property')) {
        $feed = get_post_type_archive_feed_link('property');
        echo '<link rel="alternate" type="application/rss+xml"  title="' . __('Latest Properties', 'propertyhive') . '" href="' . esc_attr($feed) . '" />';
    }
}
开发者ID:propertyhive,项目名称:WP-Property-Hive,代码行数:14,代码来源:ph-template-functions.php


示例3: wp_head

 function wp_head()
 {
     $feed = get_post_type_archive_feed_link(WPT_Production::post_type_name);
     $html = array();
     $html[] = '<link rel="alternate" type="application/rss+xml" title="' . __('New productions', 'wp_theatre') . '" href="' . $feed . '" />';
     $html[] = '<link rel="alternate" type="application/rss+xml" title="' . __('Upcoming productions', 'wp_theatre') . '" href="' . site_url('/upcoming_productions') . '" />';
     $html[] = '<link rel="alternate" type="application/rss+xml" title="' . __('Upcoming events', 'wp_theatre') . '" href="' . site_url('/upcoming_events') . '" />';
     echo implode("\n", $html) . "\n";
 }
开发者ID:henk23,项目名称:wp-theatre,代码行数:9,代码来源:wpt_feeds.php


示例4: cptrf_init

function cptrf_init()
{
    $args = array('public' => true, 'has_archive' => true, '_builtin' => false);
    foreach (get_post_types($args) as $id => $vale) {
        $feed = get_post_type_archive_feed_link($vale);
        $obj = get_post_type_object($vale);
        $name = $obj->labels->name;
        $feedname = __('Feed');
        echo '<link rel="alternate" type="application/rss+xml" title="' . get_bloginfo("name") . ' &raquo; ' . $name . ' ' . $feedname . '" 	href="' . $feed . '" />';
    }
}
开发者ID:NUTV,项目名称:nutvca,代码行数:11,代码来源:custom_post_type_rss.php


示例5: wp_head

 /**
  * Add feed and links in HEAD of the document
  */
 public function wp_head()
 {
     if (is_anspress()) {
         $q_feed = get_post_type_archive_feed_link('question');
         $a_feed = get_post_type_archive_feed_link('answer');
         echo '<link rel="alternate" type="application/rss+xml" title="' . esc_attr__('Question feed', 'ap') . '" href="' . esc_url($q_feed) . '" />';
         echo '<link rel="alternate" type="application/rss+xml" title="' . esc_attr__('Answers feed', 'ap') . '" href="' . esc_url($a_feed) . '" />';
     }
     if (is_question() && get_query_var('ap_page') != 'base') {
         echo '<link rel="canonical" href="' . esc_url(get_permalink(get_question_id())) . '">';
         echo '<link rel="shortlink" href="' . esc_url(wp_get_shortlink(get_question_id())) . '" />';
     }
 }
开发者ID:Byrlyne,项目名称:anspress,代码行数:16,代码来源:class-theme.php


示例6: purgePost

 /**
  * Purge Post
  * Flush the post
  *
  * @since 1.0
  * @param array $postId the ID of the post to be purged
  * @access public
  */
 public function purgePost($postId)
 {
     // If this is a valid post we want to purge the post,
     // the home page and any associated tags and categories
     $validPostStatus = array("publish", "trash");
     $thisPostStatus = get_post_status($postId);
     // array to collect all our URLs
     $listofurls = array();
     if (get_permalink($postId) == true && in_array($thisPostStatus, $validPostStatus)) {
         // If this is a post with a permalink AND it's published or trashed,
         // we're going to add a ton of things to flush.
         // Category purge based on Donnacha's work in WP Super Cache
         $categories = get_the_category($postId);
         if ($categories) {
             foreach ($categories as $cat) {
                 array_push($listofurls, get_category_link($cat->term_id));
             }
         }
         // Tag purge based on Donnacha's work in WP Super Cache
         $tags = get_the_tags($postId);
         if ($tags) {
             foreach ($tags as $tag) {
                 array_push($listofurls, get_tag_link($tag->term_id));
             }
         }
         // Author URL
         array_push($listofurls, get_author_posts_url(get_post_field('post_author', $postId)), get_author_feed_link(get_post_field('post_author', $postId)));
         // Archives and their feeds
         $archiveurls = array();
         if (get_post_type_archive_link(get_post_type($postId)) == true) {
             array_push($listofurls, get_post_type_archive_link(get_post_type($postId)), get_post_type_archive_feed_link(get_post_type($postId)));
         }
         // Post URL
         array_push($listofurls, get_permalink($postId));
         // Also clean URL for trashed post.
         if ($thisPostStatus == "trash") {
             $trashpost = get_permalink($postId);
             $trashpost = str_replace("__trashed", "", $trashpost);
             array_push($listofurls, $trashpost, $trashpost . 'feed/');
         }
         // Add in AMP permalink if Automattic's AMP is installed
         if (function_exists('amp_get_permalink')) {
             array_push($listofurls, amp_get_permalink($postId));
         }
         // Regular AMP url for posts
         array_push($listofurls, get_permalink($postId) . 'amp/');
         // Feeds
         array_push($listofurls, get_bloginfo_rss('rdf_url'), get_bloginfo_rss('rss_url'), get_bloginfo_rss('rss2_url'), get_bloginfo_rss('atom_url'), get_bloginfo_rss('comments_rss2_url'), get_post_comments_feed_link($postId));
         // Home Page and (if used) posts page
         array_push($listofurls, $this->the_home_url() . '/');
         if (get_option('show_on_front') == 'page') {
             // Ensure we have a page_for_posts setting to avoid empty URL
             if (get_option('page_for_posts')) {
                 array_push($listofurls, get_permalink(get_option('page_for_posts')));
             }
         }
     } else {
         // We're not sure how we got here, but bail instead of processing anything else.
         return;
     }
     // Now flush all the URLs we've collected provided the array isn't empty
     if (!empty($listofurls)) {
         foreach ($listofurls as $url) {
             array_push($this->purgeUrls, $url);
         }
     }
     // Filter to add or remove urls to the array of purged urls
     // @param array $purgeUrls the urls (paths) to be purged
     // @param int $postId the id of the new/edited post
     $this->purgeUrls = apply_filters('vhp_purge_urls', $this->purgeUrls, $postId);
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:79,代码来源:varnish-http-purge.php


示例7: get_post_type_archive_feed_link

<?php

/**
 * Standard ultimate posts widget template
 *
 * @version     2.0.0
 */
?>

<?php 
if (in_array('news', $upw_query->query_vars['post_type'])) {
    ?>
  <div class="rss-icn">
    <a href="<?php 
    echo get_post_type_archive_feed_link('news');
    ?>
"><i class="fa fa-rss-square"></i> <?php 
    _e('RSS feed', 'bvs-noticias');
    ?>
</a>
  </div>
<?php 
}
?>

<?php 
if ($instance['before_posts']) {
    ?>
  <div class="upw-before">
    <?php 
    echo wpautop($instance['before_posts']);
开发者ID:bireme,项目名称:bvs-noticias,代码行数:31,代码来源:level2.php


示例8: action_method_name

 /**
  * NOTE:  Actions are points in the execution of a page or process
  *        lifecycle that WordPress fires.
  *
  *        Actions:    http://codex.wordpress.org/Plugin_API#Actions
  *        Reference:  http://codex.wordpress.org/Plugin_API/Action_Reference
  *
  * @since    1.0.0
  */
 public function action_method_name()
 {
     $domain = $this->plugin_slug;
     $siteName = get_bloginfo("name");
     $args = array('public' => true, 'has_archive' => true, '_builtin' => false);
     $list_post_types_raw = get_post_types($args);
     $list_post_types = array_values($list_post_types_raw);
     if (is_post_type_archive()) {
         unset($list_post_types[get_post_type()]);
     }
     $list_post_types = apply_filters($domain . '-list', $list_post_types);
     foreach ($list_post_types as $id => $vale) {
         $feed = get_post_type_archive_feed_link($vale);
         $obj = get_post_type_object($vale);
         $name = $obj->labels->name;
         $feedname = sprintf(__('%1$s &raquo; %2$s Feed', $domain), $siteName, $name);
         printf(__('<link rel="%1$s" type="%2$s" title="%3$s" href="%4$s" />', $domain), "alternate", "application/rss+xml", $feedname, $feed);
     }
 }
开发者ID:spacedmonkey,项目名称:custom-post-type-rss-feed,代码行数:28,代码来源:class-custom-post-type-rss-feed.php


示例9: wc_products_rss_feed

/**
 * Products RSS Feed.
 *
 * @access public
 * @return void
 */
function wc_products_rss_feed()
{
    // Product RSS
    if (is_post_type_archive('product') || is_singular('product')) {
        $feed = get_post_type_archive_feed_link('product');
        echo '<link rel="alternate" type="application/rss+xml"  title="' . __('New products', 'woocommerce') . '" href="' . esc_attr($feed) . '" />';
    } elseif (is_tax('product_cat')) {
        $term = get_term_by('slug', esc_attr(get_query_var('product_cat')), 'product_cat');
        $feed = add_query_arg('product_cat', $term->slug, get_post_type_archive_feed_link('product'));
        echo '<link rel="alternate" type="application/rss+xml"  title="' . sprintf(__('New products added to %s', 'woocommerce'), urlencode($term->name)) . '" href="' . esc_attr($feed) . '" />';
    } elseif (is_tax('product_tag')) {
        $term = get_term_by('slug', esc_attr(get_query_var('product_tag')), 'product_tag');
        $feed = add_query_arg('product_tag', $term->slug, get_post_type_archive_feed_link('product'));
        echo '<link rel="alternate" type="application/rss+xml"  title="' . sprintf(__('New products tagged %s', 'woocommerce'), urlencode($term->name)) . '" href="' . esc_attr($feed) . '" />';
    }
}
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:22,代码来源:wc-template-functions.php


示例10: powerpressadmin_edit_itunes_general

function powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs = array())
{
    // Set default settings (if not set)
    if (!empty($FeedSettings)) {
        if (!isset($FeedSettings['itunes_url'])) {
            $FeedSettings['itunes_url'] = '';
        }
    }
    if (!isset($General['itunes_url'])) {
        $General['itunes_url'] = '';
    } else {
        if (!isset($FeedSettings['itunes_url'])) {
            // Should almost never happen
            $FeedSettings['itunes_url'] = $General['itunes_url'];
        }
    }
    $feed_slug = $FeedAttribs['feed_slug'];
    $cat_ID = $FeedAttribs['category_id'];
    if ($feed_slug == 'podcast' && $FeedAttribs['type'] == 'general') {
        if (empty($FeedSettings['itunes_url']) && !empty($General['itunes_url'])) {
            $FeedSettings['itunes_url'] = $General['itunes_url'];
        }
    }
    ?>
<h3><?php 
    echo __('iTunes Listing Information', 'powerpress');
    ?>
</h3>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php 
    echo __('iTunes Subscription URL', 'powerpress');
    ?>
</th> 
<td>
<input type="text" style="width: 80%;" name="Feed[itunes_url]" value="<?php 
    echo esc_attr($FeedSettings['itunes_url']);
    ?>
" maxlength="250" />
<p><?php 
    echo sprintf(__('e.g. %s', 'powerpress'), 'http://itunes.apple.com/podcast/title-of-podcast/id<strong>000000000</strong>');
    ?>
</p>

<p><?php 
    echo sprintf(__('Click the following link to %s.', 'powerpress'), '<a href="https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/publishPodcast" target="_blank">' . __('Publish a Podcast on iTunes', 'powerpress') . '</a>');
    ?>
 <?php 
    echo __('iTunes will email your Subscription URL to the <em>iTunes Email</em> entered below when your podcast is accepted into the iTunes Directory.', 'powerpress');
    ?>
</p>
<p>
<?php 
    echo __('Recommended feed to submit to iTunes: ', 'powerpress');
    switch ($FeedAttribs['type']) {
        case 'ttid':
        case 'category':
            echo get_category_feed_link($cat_ID);
            break;
        case 'channel':
            echo get_feed_link($feed_slug);
            break;
        case 'post_type':
            $url = get_post_type_archive_feed_link($FeedAttribs['post_type'], $feed_slug);
            echo $url;
            break;
        case 'general':
        default:
            echo get_feed_link('podcast');
    }
    ?>
</p>
</td>
</tr>
</table>
<?php 
}
开发者ID:briancfeeney,项目名称:portigal,代码行数:77,代码来源:powerpressadmin-basic.php


示例11: powerpressadmin_edit_feed_settings

function powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs = array())
{
    $SupportUploads = powerpressadmin_support_uploads();
    if (!isset($FeedSettings['posts_per_rss'])) {
        $FeedSettings['posts_per_rss'] = '';
    }
    if (!isset($FeedSettings['rss2_image'])) {
        $FeedSettings['rss2_image'] = '';
    }
    if (!isset($FeedSettings['copyright'])) {
        $FeedSettings['copyright'] = '';
    }
    if (!isset($FeedSettings['title'])) {
        $FeedSettings['title'] = '';
    }
    if (!isset($FeedSettings['rss_language'])) {
        $FeedSettings['rss_language'] = '';
    }
    $feed_link = '';
    switch ($FeedAttribs['type']) {
        case 'category':
            $feed_link = get_category_feed_link($FeedAttribs['category_id']);
            break;
        case 'ttid':
            $feed_link = get_term_feed_link($FeedAttribs['term_taxonomy_id'], $FeedAttribs['taxonomy_type'], 'rss2');
            break;
        case 'post_type':
            $feed_link = get_post_type_archive_feed_link($FeedAttribs['post_type'], $FeedAttribs['feed_slug']);
            break;
        case 'channel':
            $feed_link = get_feed_link($FeedAttribs['feed_slug']);
            break;
        default:
            $feed_link = get_feed_link('podcast');
            break;
    }
    $cat_ID = $FeedAttribs['category_id'];
    if ($FeedAttribs['type'] == 'channel' && !empty($FeedAttribs['type'])) {
        ?>
<h3><?php 
        echo __('Feed Information', 'powerpress');
        ?>
</h3>
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php 
        echo __('Feed URL', 'powerpress');
        ?>
</th>
<td>
<p style="margin-top: 0;" class="description"><a href="<?php 
        echo $feed_link;
        ?>
" target="_blank"><?php 
        echo $feed_link;
        ?>
</a> | <a href="http://www.feedvalidator.org/check.cgi?url=<?php 
        echo urlencode(str_replace('&amp;', '&', $feed_link));
        ?>
" target="_blank"><?php 
        echo __('validate', 'powerpress');
        ?>
</a></p>
<?php 
        if (!empty($FeedSettings['premium'])) {
            echo __('WARNING: This feed is password protected, it cannot be accessed by public services such as feedvalidator.org or the iTunes podcast directory.', 'powerpress');
        }
        ?>
</td>
</tr>
</table>
<?php 
    }
    ?>
<h3><?php 
    echo __('Feed Settings', 'powerpress');
    ?>
</h3>
<?php 
    if ($FeedAttribs['type'] == 'general') {
        ?>
<p class="description"><?php 
        echo __('Feed settings below only apply to the podcast only feed:', 'powerpress');
        ?>
 <?php 
        echo get_feed_link('podcast');
        ?>
</p>
<?php 
    }
    ?>
<table class="form-table">


<tr valign="top">
<th scope="row">
<?php 
    echo __('Feed Title (Show Title)', 'powerpress');
    ?>
//.........这里部分代码省略.........
开发者ID:ajay786singh,项目名称:emc,代码行数:101,代码来源:powerpressadmin-editfeed.php


示例12: webcomic_list_collections

 /**
  * Return a list of webcomic collections.
  * 
  * ### Arguments
  * 
  * - `string` **$id** - Value of the id attribute of the list element.
  * - `mixed` **$class** - String or array of additional classes for the list element.
  * - `string` **$before** - Content to display before the output.
  * - `string` **$after** - Content to display after the output.
  * - `boolean` **$hide_empty** - Whether to hide collections with no readable posts. Defaults to true.
  * - `boolean` **$ordered** - Use `<ol>` instead of `<ul>`.
  * - `string` **$collection** - Limits output to a single collection. Useful in combination with $webcomics.
  * - `string` **$order** - How to order collections, one of 'ASC' (default) or 'DESC'.
  * - `string` **$orderby** - What to sort the collections by. May be one of 'name', 'slug', 'count', or 'updated'. Defaults to collection ID.
  * - `string` **$callback** - Custom callback function for generating list items. Callback functions should accept three arguments: the collection configuration array, the function arguments array, and the posts array (if any).
  * - `string` **$feed** - Text or image URL to use for a collection feed link.
  * - `string` **$feed_type** - The type of feed to link to.
  * - `boolean` **$webcomics** - Whether to display a list of webcomic posts grouped by collection. The 'hide_empty' argument is ignored when $webcomics is true.
  * - `string` **$webcomic_order** - How to order webcomics, one of 'ASC' or 'DESC'. Defaults to 'ASC'.
  * - `string` **$webcomic_orderby** - What field to order webcomics by. Defaults to 'date'. See WP_Query for details.
  * - `string` **$webcomic_image** - Size of the webcomic image to use for webcomic links.
  * - `boolean` **$show_count** - Whether to display the total number of webcomics in a collection.
  * - `boolean` **$show_description** - Whether to display collection descriptions.
  * - `boolean` **$show_image** - Size of the collection image to use for collection links.
  * - `string` **$target** - The target url for collections, one of 'archive', 'first', 'last', or 'random'. Defaults to 'archive'.
  * - `integer` **$selected** - The ID of the selected collection or webcomic.
  * 
  * @param array $args Array of arguments. See function description for detailed information.
  * @return string
  * @uses WebcomicTag::get_webcomic_collection()
  * @uses WebcomicTag::get_webcomic_collections()
  * @uses WebcomicTag::sort_webcomic_collections_name()
  * @uses WebcomicTag::sort_webcomic_collections_slug()
  * @uses WebcomicTag::sort_webcomic_collections_count()
  * @uses WebcomicTag::sort_webcomic_collections_updated()
  * @uses WebcomicTag::get_relative_webcomic_link()
  * @filter string webcomic_collection_list_title Filters the collection titles used by `webcomic_list_collections`.
  * @filter string webcomic_list_collections Filters the output of `webcomic_list_collections`.
  * @filter string collection_list_webcomic_title Filters the webcomic titles used by `webcomic_list_collections`.
  */
 public static function webcomic_list_collections($args = array())
 {
     global $post;
     $temp_post = $post;
     $r = wp_parse_args($args, array('id' => '', 'class' => '', 'before' => '', 'after' => '', 'hide_empty' => true, 'ordered' => '', 'collection' => '', 'order' => 'ASC', 'orderby' => '', 'callback' => false, 'feed' => '', 'feed_type' => 'rss2', 'webcomics' => false, 'webcomic_order' => 'ASC', 'webcomic_orderby' => 'date', 'webcomic_image' => '', 'show_count' => false, 'show_description' => false, 'show_image' => '', 'target' => 'archive', 'selected' => 0));
     extract($r);
     $selected = $selected ? $selected : self::get_webcomic_collection();
     $collections = self::get_webcomic_collections(true);
     if ('name' === $orderby) {
         usort($collections, array('WebcomicTag', 'sort_webcomic_collections_name'));
     } elseif ('slug' === $orderby) {
         usort($collections, array('WebcomicTag', 'sort_webcomic_collections_slug'));
     } elseif ('count' === $orderby) {
         usort($collections, array('WebcomicTag', 'sort_webcomic_collections_count'));
     } elseif ('updated' === $orderby) {
         usort($collections, array('WebcomicTag', 'sort_webcomic_collections_updated'));
     }
     if ('DESC' === $order) {
         $collections = array_reverse($collections);
     }
     $output = $items = '';
     foreach ($collections as $v) {
         if (!$collection or $v['id'] === $collection) {
             $readable_count = wp_count_posts($v['id'], 'readable');
             $readable_count = $readable_count->publish + $readable_count->private;
             if (!$hide_empty or 0 < $readable_count) {
                 $collection_title = apply_filters('webcomic_collection_list_title', $v['name'], $v);
                 $feed_image = filter_var($feed, FILTER_VALIDATE_URL);
                 $feed_link = $feed ? '<a href="' . get_post_type_archive_feed_link($v['id'], $feed_type) . '" class="webcomic-collection-feed">' . ($feed_image ? '<img src="' . $feed . '" alt="' . sprintf(__('Feed for %s', 'webcomic'), get_post_type_object($v['id'])->labels->name) . '">' : $feed) . '</a>' : '';
                 if ($webcomics) {
                     $the_posts = new WP_Query(array('posts_per_page' => -1, 'post_type' => $v['id'], 'order' => $webcomic_order, 'orderby' => $webcomic_orderby));
                     if ($the_posts->have_posts()) {
                         if ($callback) {
                             $items .= call_user_func($callback, $v, $r, $the_posts);
                         } else {
                             $items .= '<li class="webcomic-collection ' . $v['id'] . ($selected === $v['id'] ? ' current' : '') . '"><a href="' . ('archive' === $target ? get_post_type_archive_link($v['id']) : self::get_relative_webcomic_link($target, false, false, '', $v['id'])) . '" class="webcomic-collection-link"><div class="webcomic-collection-name">' . $collection_title . ($show_count ? " ({$readable_count})" : '') . '</div>' . (($show_image and $v['image']) ? '<div class="webcomic-collection-image">' . apply_filters('webcomic_collection_image', wp_get_attachment_image($v['image'], $show_image), $show_image, $v['id']) . '</div>' : '') . '</a>' . (($show_description and $v['description']) ? '<div class="webcomic-collection-description">' . apply_filters('webcomic_collection_description', wpautop($v['description']), $v['id']) . '</div>' : '') . $feed_link . '<' . ($ordered ? 'ol' : 'ul') . ' class="webcomics">';
                             $i = 0;
                             while ($the_posts->have_posts()) {
                                 $the_posts->the_post();
                                 $i++;
                                 $items .= '<li' . ($selected === get_the_ID() ? ' class="current"' : '') . '><a href="' . apply_filters('the_permalink', get_permalink()) . '">' . ($webcomic_image ? WebcomicTag::the_webcomic($webcomic_image, 'self') : apply_filters('collection_list_webcomic_title', the_title('', '', false), get_post(), $i)) . '</a></li>';
                             }
                             $items .= $ordered ? '</ol></li>' : '</ul></li>';
                         }
                     }
                 } else {
                     $items .= $callback ? call_user_func($callback, $v, $r) : '<li class="webcomic-collection ' . $v['id'] . ($selected === $v['id'] ? ' current' : '') . '"><a href="' . ('archive' === $target ? get_post_type_archive_link($v['id']) : self::get_relative_webcomic_link($target, false, false, '', $v['id'])) . '" class="webcomic-collection-link"><div class="webcomic-collection-name">' . $collection_title . ($show_count ? " ({$readable_count})" : '') . '</div>' . (($show_image and $v['image']) ? '<div class="webcomic-collection-image">' . apply_filters('webcomic_collection_image', wp_get_attachment_image($v['image'], $show_image), $show_image, $v['id']) . '</div>' : '') . '</a>' . (($show_description and $v['description']) ? '<div class="webcomic-collection-description">' . apply_filters('webcomic_collection_description', wpautop($v['description']), $v['id']) . '</div>' : '') . $feed_link . '</li>';
                 }
             }
         }
     }
     if ($items) {
         $output = $before . '<' . ($ordered ? 'ol' : 'ul') . ($id ? ' id="' . esc_attr($id) . '"' : '') . ' class="' . implode(' ', array_merge(array('webcomic-collections', $collection), (array) $class)) . '">' . $items . '</' . ($ordered ? 'ol' : 'ul') . '>' . $after;
     }
     $post = $temp_post;
     return apply_filters('webcomic_list_collections', $output, $r);
 }
开发者ID:ecerta,项目名称:webcomic,代码行数:97,代码来源:tags.php


示例13: feed_links_extra

 /**
  * Display the links to the extra feeds such as category feeds.
  *
  * Copy from WP default, but without comment feed; no filter available.
  *
  * @since 04/08/2013
  *
  * @param array $args Optional argument.
  */
 public function feed_links_extra($args = array())
 {
     $defaults = ['separator' => _x('&raquo;', 'feed link'), 'cattitle' => __('%1$s %2$s %3$s Category Feed'), 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), 'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'), 'posttypetitle' => __('%1$s %2$s %3$s Feed')];
     $args = wp_parse_args($args, $defaults);
     if (is_category()) {
         $term = get_queried_object();
         $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
         $href = get_category_feed_link($term->term_id);
     } elseif (is_tag()) {
         $term = get_queried_object();
         $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
         $href = get_tag_feed_link($term->term_id);
     } elseif (is_author()) {
         $author_id = intval(get_query_var('author'));
         $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
         $href = get_author_feed_link($author_id);
     } elseif (is_search()) {
         $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(FALSE));
         $href = get_search_feed_link();
     } elseif (is_post_type_archive()) {
         $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', FALSE));
         $href = get_post_type_archive_feed_link(get_queried_object()->name);
     }
     if (isset($title) && isset($href)) {
         echo '<link rel="alternate" type="' . esc_attr(feed_content_type()) . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n";
     }
 }
开发者ID:palimadra,项目名称:Remove-Comments-Absolutely,代码行数:36,代码来源:remove-comments-absolute.php


示例14: purge_post

 public function purge_post($postId)
 {
     // If this is a valid post we want to purge the post, the home page and any associated tags & cats
     // If not, purge everything on the site.
     $validPostStatus = array('publish', 'trash');
     $thisPostStatus = get_post_status($postId);
     // If this is a revision, stop.
     if (get_permalink($postId) !== true && !in_array($thisPostStatus, $validPostStatus)) {
         return;
     } else {
         // array to collect all our URLs
         $listofurls = array();
         // Category purge based on Donnacha's work in WP Super Cache
         $categories = get_the_category($postId);
         if ($categories) {
             foreach ($categories as $cat) {
                 array_push($listofurls, get_category_link($cat->term_id));
             }
         }
         // Tag purge based on Donnacha's work in WP Super Cache
         $tags = get_the_tags($postId);
         if ($tags) {
             foreach ($tags as $tag) {
                 array_push($listofurls, get_tag_link($tag->term_id));
             }
         }
         // Author URL
         array_push($listofurls, get_author_posts_url(get_post_field('post_author', $postId)), get_author_feed_link(get_post_field('post_author', $postId)));
         // Archives and their feeds
         $archiveurls = array();
         if (get_post_type_archive_link(get_post_type($postId)) == true) {
             array_push($listofurls, get_post_type_archive_link(get_post_type($postId)), get_post_type_archive_feed_link(get_post_type($postId)));
         }
         // Post URL
         array_push($listofurls, get_permalink($postId));
         // Feeds
         array_push($listofurls, get_bloginfo_rss('rdf_url'), get_bloginfo_rss('rss_url'), get_bloginfo_rss('rss2_url'), get_bloginfo_rss('atom_url'), get_bloginfo_rss('comments_rss2_url'), get_post_comments_feed_link($postId));
         // Home Page and (if used) posts page
         array_push($listofurls, home_url('/'));
         if (get_option('show_on_front') == 'page') {
             array_push($listofurls, get_permalink(get_option('page_for_posts')));
         }
         // If Automattic's AMP is installed, add AMP permalink
         if (function_exists('amp_get_permalink')) {
             array_push($listofurls, amp_get_permalink($postId));
         }
         // Now flush all the URLs we've collected
         foreach ($listofurls as $url) {
             array_push($this->purgeUrls, $url);
         }
     }
     // Filter to add or remove urls to the array of purged urls
     // @param array $purgeUrls the urls (paths) to be purged
     // @param int $postId the id of the new/edited post
     $this->purgeUrls = apply_filters('vcaching_purge_urls', $this->purgeUrls, $postId);
     $this->purge_cache();
 }
开发者ID:razvanstanga,项目名称:varnish-caching-wordpress-plugin,代码行数:57,代码来源:vcaching.php


示例15: powerpresssubscribe_get_settings


//.........这里部分代码省略.........
        }
        if ($category_id) {
            $Settings = get_option('powerpress_cat_feed_' . $category_id);
            if (!empty($Settings)) {
                //$Settings['title'] = $Settings['title'];
                if (empty($Settings['title'])) {
                    $Settings['title'] = get_bloginfo('name') . get_wp_title_rss();
                }
                // Get category title
                if (!empty($Settings['feed_redirect_url'])) {
                    $Settings['feed_url'] = $Settings['feed_redirect_url'];
                } else {
                    $Settings['feed_url'] = get_category_feed_link($category_id);
                }
                // Get category feed URL
                $Settings['subscribe_page_url'] = powerpresssubscribe_get_subscribe_page($Settings);
                $Settings['itunes_url'] = powerpresssubscribe_get_itunes_url($Settings);
                $Settings['image_url'] = $Settings['itunes_image'];
                $Settings['subscribe_feature_email'] = !empty($GeneralSettings['subscribe_feature_email']);
                return $Settings;
            }
        }
        if ($ExtraData['subscribe_type'] == 'category') {
            return false;
        }
        // let fall through to find better settings
    }
    // Taxonomy
    if ($ExtraData['subscribe_type'] == 'ttid') {
        if (!empty($GeneralSettings['taxonomy_podcasting'])) {
            // TODO! Taxonomy Podcasting subscription options
        }
        return false;
    }
    // Post Type Podcasting
    if ($ExtraData['subscribe_type'] == 'post_type') {
        if (!empty($GeneralSettings['posttype_podcasting'])) {
            if (empty($post_type) && !empty($ExtraData['id'])) {
                $post_type = get_post_type($ExtraData['id']);
            }
            switch ($post_type) {
                case 'page':
                case 'post':
                    // SWEET, CARRY ON!
                    break;
                default:
                    $SettingsArray = get_option('powerpress_posttype_' . $post_type);
                    $Settings = false;
                    if (!empty($SettingsArray[$feed_slug])) {
                        $Settings = $SettingsArray[$feed_slug];
                    }
                    if (!empty($Settings)) {
                        $Settings['title'] = $Settings['title'];
                        if (empty($Settings['title'])) {
                            $Settings['title'] = get_bloginfo('name') . get_wp_title_rss();
                        }
                        // Get category title
                        if (!empty($Settings['feed_redirect_url'])) {
                            $Settings['feed_url'] = $Settings['feed_redirect_url'];
                        } else {
                            $Settings['feed_url'] = get_post_type_archive_feed_link($post_type, $feed_slug);
                        }
                        // Get category feed URL
                        $Settings['subscribe_page_url'] = powerpresssubscribe_get_subscribe_page($Settings);
                        $Settings['itunes_url'] = powerpresssubscribe_get_itunes_url($Settings);
                        $Settings['image_url'] = $Settings['itunes_image'];
                        $Settings['subscribe_feature_email'] = !empty($GeneralSettings['subscribe_feature_email']);
                        return $Settings;
                    }
                    break;
            }
        }
        return false;
    }
    // Podcast default and channel feed settings
    $FeedSettings = get_option('powerpress_feed_' . $feed_slug);
    if (empty($FeedSettings) && $feed_slug == 'podcast') {
        $FeedSettings = get_option('powerpress_feed');
    }
    // Get the main feed settings
    if (!empty($FeedSettings)) {
        $FeedSettings['title'] = $FeedSettings['title'];
        if (empty($FeedSettings['title'])) {
            $FeedSettings['title'] = get_bloginfo('name');
        }
        // Get blog title
        if (!empty($FeedSettings['feed_redirect_url'])) {
            $FeedSettings['feed_url'] = $FeedSettings['feed_redirect_url'];
        } else {
            $FeedSettings['feed_url'] = get_feed_link($feed_slug);
        }
        // Get Podcast RSS Feed
        $FeedSettings['subscribe_page_url'] = powerpresssubscribe_get_subscribe_page($FeedSettings);
        $FeedSettings['itunes_url'] = powerpresssubscribe_get_itunes_url($FeedSettings);
        $FeedSettings['image_url'] = $FeedSettings['itunes_image'];
        $FeedSettings['subscribe_feature_email'] = !empty($GeneralSettings['subscribe_feature_email']);
        return $FeedSettings;
    }
    return false;
}
开发者ID:mattsims,项目名称:powerpress,代码行数:101,代码来源:powerpress-subscribe.php


示例16: locate_post_type_archive_url

 /**
  * Get the post type archives associated with the post.
  *
  * @since 1.0.0.
  *
  * @param  WP_Post $post The post object to search for post type information.
  * @return array         The related post type archive URLs.
  */
 public function locate_post_type_archive_url($post)
 {
     $related = array();
     $post_type = get_post_type($post);
     $post_type_page = get_post_type_archive_link($post_type);
     $post_type_feed = get_post_type_archive_feed_link($post_type);
     if (false !== $post_type_page) {
         $related[] = $post_type_page;
     }
     if (false !== $post_type_feed) {
         $related[] = $post_type_feed;
     }
     if (!empty($related)) {
         $this->set_related_urls_by_category($related, 'post-type-archive');
     }
     return $related;
 }
开发者ID:KostasNi,项目名称:purgely,代码行数:25,代码来源:related-urls.php


示例17: get_feed_link

 /**
  * Workaround for get_feed_link function, remove filtering.
  * @param string $feed
  * @param null|string $post_type
  * @return mixed
  */
 function get_feed_link($feed = '', $post_type = null)
 {
     /**
      * @var $wp_rewrite WP_Rewrite
      */
     global $wp_rewrite;
     if ($post_type) {
         return get_post_type_archive_feed_link($post_type, $feed);
     }
     $permalink = $wp_rewrite->get_feed_permastruct();
     if ('' != $permalink) {
         if (false !== strpos($feed, 'comments_')) {
             $feed = str_replace('comments_', '', $feed);
             $permalink = $wp_rewrite->get_comment_feed_permastruct();
         }
         if (get_default_feed() == $feed) {
             $feed = '';
         }
         $permalink = str_replace('%feed%', $feed, $permalink);
         $permalink = preg_replace('#/+#', '/', "/{$permalink}");
         $output = home_url(user_trailingslashit($permalink, 'feed'));
     } else {
         if (empty($feed)) {
             $feed = get_default_feed();
         }
         if (false !== strpos($feed, 'comments_')) {
             $feed = str_replace('comments_', 'comments-', $feed);
         }
         $output = home_url("?feed={$feed}");
     }
     return $output;
 }
开发者ID:getupcloud,项目名称:wordpress-ex,代码行数:38,代码来源:PageUrls.php


示例18: wprss_cpt_feeds

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_post_type_archive_link函数代码示例发布时间:2022-05-15
下一篇:
PHP get_post_type函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap