/**
  * 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 );
 }
/**
	*存档页信息
	*http://www.bgbk.org
*/
function Bing_archive_header()
{
    if (!is_archive()) {
        return;
    }
    if (is_author()) {
        $dashicons = 'admin-users';
        $name = $GLOBALS['authordata']->display_name;
        $description = get_the_author_meta('description');
        $feed_link = get_author_feed_link($GLOBALS['authordata']->ID);
    } elseif (is_date()) {
        $dashicons = 'calendar';
        if (is_day()) {
            $format = __('Y年m月d日', 'Bing');
        } elseif (is_month()) {
            $format = __('Y年m月', 'Bing');
        } else {
            $format = __('Y年', 'Bing');
        }
        $name = get_the_date($format);
        $description = sprintf(__('%s发布的文章', 'Bing'), $name);
    } else {
        $dashicons = is_tag() ? 'tag' : 'category';
        $name = single_term_title('', false);
        $description = term_description();
        $feed_link = get_term_feed_link(get_queried_object_id(), get_queried_object()->taxonomy);
    }
    $description = strip_tags($description);
    ?>
	<div class="span12 archive-header">
		<article class="panel">
			<header class="panel-header">
				<h3>
					<span class="dashicons dashicons-<?php 
    echo $dashicons;
    ?>
"></span><?php 
    echo $name;
    ?>
				</h3>
				<?php 
    if (Bing_mpanel('breadcrumbs')) {
        Bing_breadcrumbs('<span class="separator dashicons dashicons-arrow-right-alt2"></span>', '<span class="right breadcrumb"%s>', '</span>', '<span class="dashicons dashicons-admin-home"></span>' . __('首页', 'Bing'));
    }
    ?>
			</header>
			<?php 
    echo empty($description) ? __('无描述', 'Bing') : $description;
    if (!empty($feed_link)) {
        printf('<a href="%s" title="%s" class="feed-link"><span class="dashicons dashicons-rss"></span></a>', esc_url($feed_link), esc_attr(__('此存档的 Feed 源,可以使用 RSS 阅读器订阅这些内容', 'Bing')));
    }
    ?>
		</article>
	</div>
<?php 
}
示例#3
0
 public function getAuthors()
 {
     global $wpdb;
     $query = "SELECT u.ID, u.display_name AS name, ud.meta_value as bio, yim.meta_value as yim, COUNT(p.ID) as post_count, u.user_email, u.user_url FROM wp_users AS u\r\n                  LEFT JOIN wp_usermeta AS ud ON (u.ID = ud.user_id AND ud.meta_key = 'description')\r\n                  LEFT JOIN wp_usermeta AS yim ON (u.ID = yim.user_id AND yim.meta_key = 'yim')\r\n                  LEFT JOIN wp_posts AS p ON (p.post_author = u.ID AND p.post_type='post' AND p.post_status = 'publish')\r\n                  GROUP BY u.ID HAVING COUNT(p.ID) > 0 ORDER BY COUNT(p.ID) DESC";
     $authorsQuery = $wpdb->get_results($query);
     $authors = array();
     foreach ($authorsQuery as $author) {
         $authors[$author->ID] = array();
         $authors[$author->ID]['avatar'] = get_avatar_url($author->ID, '150');
         $authors[$author->ID]['url'] = get_author_posts_url($author->ID);
         $authors[$author->ID]['name'] = $author->name;
         $authors[$author->ID]['bio'] = $author->bio;
         $authors[$author->ID]['count'] = $author->post_count;
         $authors[$author->ID]['feed'] = get_author_feed_link($author->ID);
         $authors[$author->ID]['email'] = $author->user_email;
         $authors[$author->ID]['website'] = $author->user_url;
         $authors[$author->ID]['yim'] = $author->yim;
     }
     wp_reset_query();
     return $authors;
 }
示例#4
0
/**
 * List all the authors of the blog, with several options available.
 *
 * <ul>
 * <li>optioncount (boolean) (false): Show the count in parenthesis next to the
 * author's name.</li>
 * <li>exclude_admin (boolean) (true): Exclude the 'admin' user that is
 * installed bydefault.</li>
 * <li>show_fullname (boolean) (false): Show their full names.</li>
 * <li>hide_empty (boolean) (true): Don't show authors without any posts.</li>
 * <li>feed (string) (''): If isn't empty, show links to author's feeds.</li>
 * <li>feed_image (string) (''): If isn't empty, use this image to link to
 * feeds.</li>
 * <li>echo (boolean) (true): Set to false to return the output, instead of
 * echoing.</li>
 * <li>style (string) ('list'): Whether to display list of authors in list form
 * or as a string.</li>
 * <li>html (bool) (true): Whether to list the items in html form or plaintext.
 * </li>
 * </ul>
 *
 * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
 * @since 1.2.0
 * @param array $args The argument array.
 * @return null|string The output, if echo is set to false.
 */
function wp_list_authors($args = '')
{
    global $wpdb;
    $defaults = array('orderby' => 'name', 'order' => 'ASC', 'number' => '', 'optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, 'style' => 'list', 'html' => true);
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $return = '';
    $query_args = wp_array_slice_assoc($args, array('orderby', 'order', 'number'));
    $query_args['fields'] = 'ids';
    $authors = get_users($query_args);
    $author_count = array();
    foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM {$wpdb->posts} WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " GROUP BY post_author") as $row) {
        $author_count[$row->post_author] = $row->count;
    }
    foreach ($authors as $author_id) {
        $author = get_userdata($author_id);
        if ($exclude_admin && 'admin' == $author->display_name) {
            continue;
        }
        $posts = isset($author_count[$author->ID]) ? $author_count[$author->ID] : 0;
        if (!$posts && $hide_empty) {
            continue;
        }
        $link = '';
        if ($show_fullname && $author->first_name && $author->last_name) {
            $name = "{$author->first_name} {$author->last_name}";
        } else {
            $name = $author->display_name;
        }
        if (!$html) {
            $return .= $name . ', ';
            continue;
            // No need to go further to process HTML.
        }
        if ('list' == $style) {
            $return .= '<li>';
        }
        $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . esc_attr(sprintf(__("Posts by %s"), $author->display_name)) . '">' . $name . '</a>';
        if (!empty($feed_image) || !empty($feed)) {
            $link .= ' ';
            if (empty($feed_image)) {
                $link .= '(';
            }
            $link .= '<a href="' . get_author_feed_link($author->ID) . '"';
            $alt = $title = '';
            if (!empty($feed)) {
                $title = ' title="' . esc_attr($feed) . '"';
                $alt = ' alt="' . esc_attr($feed) . '"';
                $name = $feed;
                $link .= $title;
            }
            $link .= '>';
            if (!empty($feed_image)) {
                $link .= '<img src="' . esc_url($feed_image) . '" style="border: none;"' . $alt . $title . ' />';
            } else {
                $link .= $name;
            }
            $link .= '</a>';
            if (empty($feed_image)) {
                $link .= ')';
            }
        }
        if ($optioncount) {
            $link .= ' (' . $posts . ')';
        }
        $return .= $link;
        $return .= 'list' == $style ? '</li>' : ', ';
    }
    $return = rtrim($return, ', ');
    if (!$echo) {
        return $return;
    }
    echo $return;
}
示例#5
0
 /**
  * Flushes post cache
  *
  * @param integer $post_id
  * @return boolean
  */
 function flush_post($post_id = null)
 {
     if (!$post_id) {
         $post_id = $this->_detect_post_id();
     }
     if ($post_id) {
         $uris = array();
         $domain_url = w3_get_domain_url();
         $feeds = $this->_config->get_array('pgcache.purge.feed.types');
         if ($this->_config->get_boolean('pgcache.purge.terms') || $this->_config->get_boolean('pgcache.purge.feed.terms')) {
             $taxonomies = get_post_taxonomies($post_id);
             $terms = nxt_get_post_terms($post_id, $taxonomies);
         }
         switch (true) {
             case $this->_config->get_boolean('pgcache.purge.author'):
             case $this->_config->get_boolean('pgcache.purge.archive.daily'):
             case $this->_config->get_boolean('pgcache.purge.archive.monthly'):
             case $this->_config->get_boolean('pgcache.purge.archive.yearly'):
             case $this->_config->get_boolean('pgcache.purge.feed.author'):
                 $post = get_post($post_id);
         }
         /**
          * Home URL
          */
         if ($this->_config->get_boolean('pgcache.purge.home')) {
             $home_path = w3_get_home_path();
             $site_path = w3_get_site_path();
             $uris[] = $home_path;
             if ($site_path != $home_path) {
                 $uris[] = $site_path;
             }
         }
         /**
          * Post URL
          */
         if ($this->_config->get_boolean('pgcache.purge.post')) {
             $post_link = post_permalink($post_id);
             $post_uri = str_replace($domain_url, '', $post_link);
             $uris[] = $post_uri;
         }
         /**
          * Post comments URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.comments') && function_exists('get_comments_pagenum_link')) {
             $comments_number = get_comments_number($post_id);
             $comments_per_page = get_option('comments_per_page');
             $comments_pages_number = @ceil($comments_number / $comments_per_page);
             for ($pagenum = 1; $pagenum <= $comments_pages_number; $pagenum++) {
                 $comments_pagenum_link = $this->_get_comments_pagenum_link($post_id, $pagenum);
                 $comments_pagenum_uri = str_replace($domain_url, '', $comments_pagenum_link);
                 $uris[] = $comments_pagenum_uri;
             }
         }
         /**
          * Post author URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.author') && $post) {
             $posts_number = count_user_posts($post->post_author);
             $posts_per_page = get_option('posts_per_page');
             $posts_pages_number = @ceil($posts_number / $posts_per_page);
             $author_link = get_author_link(false, $post->post_author);
             $author_uri = str_replace($domain_url, '', $author_link);
             for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
                 $author_pagenum_link = $this->_get_pagenum_link($author_uri, $pagenum);
                 $author_pagenum_uri = str_replace($domain_url, '', $author_pagenum_link);
                 $uris[] = $author_pagenum_uri;
             }
         }
         /**
          * Post terms URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.terms')) {
             $posts_per_page = get_option('posts_per_page');
             foreach ($terms as $term) {
                 $term_link = get_term_link($term, $term->taxonomy);
                 $term_uri = str_replace($domain_url, '', $term_link);
                 $posts_pages_number = @ceil($term->count / $posts_per_page);
                 for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
                     $term_pagenum_link = $this->_get_pagenum_link($term_uri, $pagenum);
                     $term_pagenum_uri = str_replace($domain_url, '', $term_pagenum_link);
                     $uris[] = $term_pagenum_uri;
                 }
             }
         }
         /**
          * Daily archive URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.archive.daily') && $post) {
             $post_date = strtotime($post->post_date);
             $post_year = gmdate('Y', $post_date);
             $post_month = gmdate('m', $post_date);
             $post_day = gmdate('d', $post_date);
             $posts_per_page = get_option('posts_per_page');
             $posts_number = $this->_get_archive_posts_count($post_year, $post_month, $post_day);
             $posts_pages_number = @ceil($posts_number / $posts_per_page);
             $day_link = get_day_link($post_year, $post_month, $post_day);
             $day_uri = str_replace($domain_url, '', $day_link);
             for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
                 $day_pagenum_link = $this->_get_pagenum_link($day_uri, $pagenum);
                 $day_pagenum_uri = str_replace($domain_url, '', $day_pagenum_link);
                 $uris[] = $day_pagenum_uri;
             }
         }
         /**
          * Monthly archive URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.archive.monthly') && $post) {
             $post_date = strtotime($post->post_date);
             $post_year = gmdate('Y', $post_date);
             $post_month = gmdate('m', $post_date);
             $posts_per_page = get_option('posts_per_page');
             $posts_number = $this->_get_archive_posts_count($post_year, $post_month);
             $posts_pages_number = @ceil($posts_number / $posts_per_page);
             $month_link = get_month_link($post_year, $post_month);
             $month_uri = str_replace($domain_url, '', $month_link);
             for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
                 $month_pagenum_link = $this->_get_pagenum_link($month_uri, $pagenum);
                 $month_pagenum_uri = str_replace($domain_url, '', $month_pagenum_link);
                 $uris[] = $month_pagenum_uri;
             }
         }
         /**
          * Yearly archive URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.archive.yearly') && $post) {
             $post_date = strtotime($post->post_date);
             $post_year = gmdate('Y', $post_date);
             $posts_per_page = get_option('posts_per_page');
             $posts_number = $this->_get_archive_posts_count($post_year);
             $posts_pages_number = @ceil($posts_number / $posts_per_page);
             $year_link = get_year_link($post_year);
             $year_uri = str_replace($domain_url, '', $year_link);
             for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
                 $year_pagenum_link = $this->_get_pagenum_link($year_uri, $pagenum);
                 $year_pagenum_uri = str_replace($domain_url, '', $year_pagenum_link);
                 $uris[] = $year_pagenum_uri;
             }
         }
         /**
          * Feed URLs
          */
         if ($this->_config->get_boolean('pgcache.purge.feed.blog')) {
             foreach ($feeds as $feed) {
                 $feed_link = get_feed_link($feed);
                 $feed_uri = str_replace($domain_url, '', $feed_link);
                 $uris[] = $feed_uri;
             }
         }
         if ($this->_config->get_boolean('pgcache.purge.feed.comments')) {
             foreach ($feeds as $feed) {
                 $post_comments_feed_link = get_post_comments_feed_link($post_id, $feed);
                 $post_comments_feed_uri = str_replace($domain_url, '', $post_comments_feed_link);
                 $uris[] = $post_comments_feed_uri;
             }
         }
         if ($this->_config->get_boolean('pgcache.purge.feed.author') && $post) {
             foreach ($feeds as $feed) {
                 $author_feed_link = get_author_feed_link($post->post_author, $feed);
                 $author_feed_uri = str_replace($domain_url, '', $author_feed_link);
                 $uris[] = $author_feed_uri;
             }
         }
         if ($this->_config->get_boolean('pgcache.purge.feed.terms')) {
             foreach ($terms as $term) {
                 foreach ($feeds as $feed) {
                     $term_feed_link = get_term_feed_link($term->term_id, $term->taxonomy, $feed);
                     $term_feed_uri = str_replace($domain_url, '', $term_feed_link);
                     $uris[] = $term_feed_uri;
                 }
             }
         }
         /**
          * Flush cache
          */
         if (count($uris)) {
             $cache =& $this->_get_cache();
             $mobile_groups = $this->_get_mobile_groups();
             $referrer_groups = $this->_get_referrer_groups();
             $encryptions = $this->_get_encryptions();
             $compressions = $this->_get_compressions();
             foreach ($uris as $uri) {
                 foreach ($mobile_groups as $mobile_group) {
                     foreach ($referrer_groups as $referrer_group) {
                         foreach ($encryptions as $encryption) {
                             foreach ($compressions as $compression) {
                                 $page_key = $this->_get_page_key($uri, $mobile_group, $referrer_group, $encryption, $compression);
                                 $cache->delete($page_key);
                             }
                         }
                     }
                 }
             }
             /**
              * Purge varnish servers
              */
             if ($this->_config->get_boolean('varnish.enabled')) {
                 $varnish =& w3_instance('W3_Varnish');
                 foreach ($uris as $uri) {
                     $varnish->purge($uri);
                 }
             }
         }
         return true;
     }
     return false;
 }
示例#6
0
:</b> <?php 
            the_author_description();
            ?>
</p>
			<p><i>&raquo; Read more by <?php 
            the_author_posts_link();
            ?>
</i><br/>
<?php 
            ob_start();
            the_author_ID();
            $AuthorID = ob_get_contents();
            ob_end_clean();
            ?>
			<i><a href="<?php 
            echo get_author_feed_link($AuthorID);
            ?>
"><img src="/wp-content/themes/welovedc-theme/img/feed.png" alt="RSS" /><?php 
            the_author();
            ?>
's RSS feed</a></i></p>
		</div><!--/abouttheauthor-->

		<div id="articletools" class="sidebar-section">
			<h2><span>Article Tools</span></h2>
			<ul>
			<li id="tools-print"><a href="<?php 
            the_permalink();
            ?>
?print">Printable View</a></li>
			<li id="tools-email"><?php 
/**
 * List all the *co-authors* of the blog, with several options available.
 * optioncount (boolean) (false): Show the count in parenthesis next to the author's name.
 * show_fullname (boolean) (false): Show their full names.
 * hide_empty (boolean) (true): Don't show authors without any posts.
 * feed (string) (''): If isn't empty, show links to author's feeds.
 * feed_image (string) (''): If isn't empty, use this image to link to feeds.
 * echo (boolean) (true): Set to false to return the output, instead of echoing.
 * @param array $args The argument array.
 * @return null|string The output, if echo is set to false.
 */
function coauthors_wp_list_authors($args = array())
{
    global $coauthors_plus;
    $defaults = array('optioncount' => false, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, 'style' => 'list', 'html' => true, 'number' => 20);
    $args = wp_parse_args($args, $defaults);
    $return = '';
    $term_args = array('orderby' => 'name', 'hide_empty' => 0, 'number' => (int) $args['number']);
    $author_terms = get_terms($coauthors_plus->coauthor_taxonomy, $term_args);
    $authors = array();
    foreach ($author_terms as $author_term) {
        // Something's wrong in the state of Denmark
        if (false === ($coauthor = $coauthors_plus->get_coauthor_by('user_login', $author_term->name))) {
            continue;
        }
        $authors[$author_term->name] = $coauthor;
        $authors[$author_term->name]->post_count = $author_term->count;
    }
    $authors = apply_filters('coauthors_wp_list_authors_array', $authors);
    foreach ((array) $authors as $author) {
        $link = '';
        if ($args['show_fullname'] && ($author->first_name && $author->last_name)) {
            $name = "{$author->first_name} {$author->last_name}";
        } else {
            $name = $author->display_name;
        }
        if (!$args['html']) {
            if ($author->post_count == 0) {
                if (!$args['hide_empty']) {
                    $return .= $name . ', ';
                }
            } else {
                $return .= $name . ', ';
            }
            // No need to go further to process HTML.
            continue;
        }
        if (!($author->post_count == 0 && $args['hide_empty']) && 'list' == $args['style']) {
            $return .= '<li>';
        }
        if ($author->post_count == 0) {
            if (!$args['hide_empty']) {
                $link = $name;
            }
        } else {
            $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . esc_attr(sprintf(__('Posts by %s', 'co-authors-plus'), $name)) . '">' . esc_html($name) . '</a>';
            if (!empty($args['feed_image']) || !empty($args['feed'])) {
                $link .= ' ';
                if (empty($args['feed_image'])) {
                    $link .= '(';
                }
                $link .= '<a href="' . get_author_feed_link($author->ID) . '"';
                if (!empty($args['feed'])) {
                    $title = ' title="' . esc_attr($args['feed']) . '"';
                    $alt = ' alt="' . esc_attr($args['feed']) . '"';
                    $name = $feed;
                    $link .= $title;
                }
                $link .= '>';
                if (!empty($args['feed_image'])) {
                    $link .= '<img src="' . esc_url($args['feed_image']) . "\" style=\"border: none;\"{$alt}{$title}" . ' />';
                } else {
                    $link .= $name;
                }
                $link .= '</a>';
                if (empty($args['feed_image'])) {
                    $link .= ')';
                }
            }
            if ($args['optioncount']) {
                $link .= ' (' . $author->post_count . ')';
            }
        }
        if (!($author->post_count == 0 && $args['hide_empty']) && 'list' == $args['style']) {
            $return .= $link . '</li>';
        } else {
            if (!$args['hide_empty']) {
                $return .= $link . ', ';
            }
        }
    }
    $return = trim($return, ', ');
    if (!$args['echo']) {
        return $return;
    }
    echo $return;
}
示例#8
0
 public function getAuthor()
 {
     $pathway = array();
     $user = wpi_get_current_author();
     //  rss
     $pathway['first'] = array($user->display_name . ' feeds', array('href' => get_author_feed_link($user->ID), 'type' => 'application/rss+xml', 'title' => __($user->display_name . ' | Subscribe to this author feed', WPI_META), 'hreflang' => get_hreflang(), 'rel' => self::RSS_REL, 'class' => 'rtxt rss16', 'rev' => 'feed:rss2'));
     // home
     $pathway['home'] = $this->getFrontpage();
     $pathway['archive'] = array(__('Author', WPI_META), array('href' => '#content-top', 'title' => __('Author | Skip to content', WPI_META)));
     $pathway['last'] = array($user->display_name, array('href' => '#content-top', 'class' => self::DN_ARROW, 'title' => __('Author | Skip to content', WPI_META)));
     return $pathway;
 }
/**
 * List all the authors of the blog, with several options available.
 *
 * <ul>
 * <li>optioncount (boolean) (false): Show the count in parenthesis next to the
 * author's name.</li>
 * <li>exclude_admin (boolean) (true): Exclude the 'admin' user that is
 * installed bydefault.</li>
 * <li>show_fullname (boolean) (false): Show their full names.</li>
 * <li>hide_empty (boolean) (true): Don't show authors without any posts.</li>
 * <li>feed (string) (''): If isn't empty, show links to author's feeds.</li>
 * <li>feed_image (string) (''): If isn't empty, use this image to link to
 * feeds.</li>
 * <li>echo (boolean) (true): Set to false to return the output, instead of
 * echoing.</li>
 * <li>style (string) ('list'): Whether to display list of authors in list form
 * or as a string.</li>
 * <li>html (bool) (true): Whether to list the items in html for or plaintext.
 * </li>
 * </ul>
 *
 * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
 * @since 1.2.0
 * @param array $args The argument array.
 * @return null|string The output, if echo is set to false.
 */
function wp_list_authors($args = '')
{
    global $wpdb;
    $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, 'style' => 'list', 'html' => true);
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $return = '';
    /** @todo Move select to get_authors(). */
    $users = get_users_of_blog();
    $author_ids = array();
    foreach ((array) $users as $user) {
        $author_ids[] = $user->user_id;
    }
    if (count($author_ids) > 0) {
        $author_ids = implode(',', $author_ids);
        $authors = $wpdb->get_results("SELECT ID, user_nicename from {$wpdb->users} WHERE ID IN({$author_ids}) " . ($exclude_admin ? "AND user_login <> 'admin' " : '') . "ORDER BY display_name");
    } else {
        $authors = array();
    }
    $author_count = array();
    foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM {$wpdb->posts} WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " GROUP BY post_author") as $row) {
        $author_count[$row->post_author] = $row->count;
    }
    foreach ((array) $authors as $author) {
        $link = '';
        $author = get_userdata($author->ID);
        $posts = isset($author_count[$author->ID]) ? $author_count[$author->ID] : 0;
        $name = $author->display_name;
        if ($show_fullname && ($author->first_name != '' && $author->last_name != '')) {
            $name = "{$author->first_name} {$author->last_name}";
        }
        if (!$html) {
            if ($posts == 0) {
                if (!$hide_empty) {
                    $return .= $name . ', ';
                }
            } else {
                $return .= $name . ', ';
            }
            // No need to go further to process HTML.
            continue;
        }
        if (!($posts == 0 && $hide_empty) && 'list' == $style) {
            $return .= '<li>';
        }
        if ($posts == 0) {
            if (!$hide_empty) {
                $link = $name;
            }
        } else {
            $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . esc_attr(sprintf(__("Posts by %s"), $author->display_name)) . '">' . $name . '</a>';
            if (!empty($feed_image) || !empty($feed)) {
                $link .= ' ';
                if (empty($feed_image)) {
                    $link .= '(';
                }
                $link .= '<a href="' . get_author_feed_link($author->ID) . '"';
                if (!empty($feed)) {
                    $title = ' title="' . esc_attr($feed) . '"';
                    $alt = ' alt="' . esc_attr($feed) . '"';
                    $name = $feed;
                    $link .= $title;
                }
                $link .= '>';
                if (!empty($feed_image)) {
                    $link .= "<img src=\"" . esc_url($feed_image) . "\" style=\"border: none;\"{$alt}{$title}" . ' />';
                } else {
                    $link .= $name;
                }
                $link .= '</a>';
                if (empty($feed_image)) {
                    $link .= ')';
                }
            }
            if ($optioncount) {
                $link .= ' (' . $posts . ')';
            }
        }
        if (!($posts == 0 && $hide_empty) && 'list' == $style) {
            $return .= $link . '</li>';
        } else {
            if (!$hide_empty) {
                $return .= $link . ', ';
            }
        }
    }
    $return = trim($return, ', ');
    if (!$echo) {
        return $return;
    }
    echo $return;
}
示例#10
0
文件: author.php 项目: alx/pressmark
<?php

get_header();
?>

<div id="userpage">
<div id="main">

<?php 
if (have_posts()) {
    $first_post = true;
    while (have_posts()) {
        the_post();
        $author_feed_url = '';
        if (function_exists('get_author_feed_link')) {
            $author_feed_url = get_author_feed_link(get_the_author_ID());
        } else {
            $author_feed_url = get_author_rss_link(false, get_the_author_ID(), get_the_author_nickname());
        }
        ?>

<?php 
        if ($first_post === true) {
            ?>
	<h2>
		<?php 
            echo get_avatar(get_the_author_email(), 48);
            ?>
		Updates from <?php 
            the_author_posts_link();
            ?>
 * @since OSN 1.0
 */
get_header();
?>

	<section id="primary" class="content-area">
		<div id="content" class="site-content" role="main">

			<?php 
if (have_posts()) {
    ?>

				<?php 
    $curauth = isset($_GET['author_name']) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    if (!empty($curauth)) {
        echo '<div class="author-feed">Subscribe to the RSS feed: <a href="' . get_author_feed_link($curauth->ID) . '" title="' . sprintf(__('Subscribe to RSS', 'appthemes'), $curauth->name) . '">' . '<img src="' . get_stylesheet_directory_uri() . '/images/feed-icon-28x28.png" alt="RSS feed icon" />' . '</a></div>';
    }
    /*
     * Since we called the_post() above, we need to rewind
     * the loop back to the beginning that way we can run
     * the loop properly, in full.
     */
    rewind_posts();
    // Start the Loop.
    while (have_posts()) {
        the_post();
        /*
         * Include the post format-specific template for the content. If you want to
         * use this in a child theme, then include a file called called content-___.php
         * (where ___ is the post format) and that will be used instead.
         */
示例#12
0
" class="icon-link"><?php 
        echo esc_html($byline_text);
        ?>
</a>
			<?php 
    } else {
        ?>
				<?php 
        // $coauthor covers base case (1 dimensional) or where coauthors were defined.
        ?>
				<?php 
        foreach ($coauthors as $author) {
            ?>
					<div class="follow-author">
					<a href="<?php 
            echo get_author_feed_link($author->ID, '');
            ?>
" class="icon-rss"></a>
					<?php 
            if ($twitter = get_the_author_meta('twitter', $author->ID)) {
                ?>
						<a href="https://twitter.com/<?php 
                echo largo_twitter_url_to_username(esc_url($twitter));
                ?>
" class="icon-twitter"></a>
					<?php 
            }
            ?>
					<a href="<?php 
            echo get_author_posts_url($author->ID, $author->user_nicename);
            ?>
示例#13
0
 /**
  * Get author links related to this post.
  *
  * @since 1.0.0.
  *
  * @param  WP_Post $post The post object to search for related author information.
  * @return array               The related author URLs.
  */
 public function locate_author_urls($post)
 {
     $author = $post->post_author;
     $author_page = get_author_posts_url($author);
     $author_feed = get_author_feed_link($author);
     $this->set_related_url($author_page, 'author');
     $this->set_related_url($author_feed, 'author');
     return array($author_page, $author_feed);
 }
示例#14
0
            <ul>
              <?php 
if ($user_url && $user_url != '') {
    ?>
                <li class="author-url">
                    <a href="<?php 
    echo $user_url;
    ?>
"><i class="icon-home"></i></a>
                </li>
              <?php 
}
?>
              <li class="author-rss">
                  <a href="<?php 
echo get_author_feed_link($curauth->ID);
?>
"><i class="icon-rss"></i></a>
              </li>
              <?php 
if ($twitter_profile && $twitter_profile != '') {
    ?>
                <li class="author-twitter">
                    <a href="<?php 
    echo $twitter_profile;
    ?>
"><i class="icon-twitter"></i></a>
                </li>
              <?php 
}
?>
示例#15
0
				</div>
			</div>
		</div>




		<article id="mainContent" class="splitLayout overviewPage">
			<div class="container blogPageMainContent">
				<div class="rightSplit  grid-3-3">
					<div class="mainStream grid-2-3">
						<section id="blogPageContent" class="pageContent">
						<div class="subscribeTopWrapper">
							<?php 
$catName = $activeMenuObj->cat_name;
$feedUrl = get_author_feed_link($authorId, '');
?>
							<span class="currentCatLink rssCat">Browse Post Write by : <?php 
echo $authorObj->display_name;
?>
</span>
							<!--<a class="feedBtn" href="<?php 
echo $feedUrl;
?>
">Subscribe to <?php 
echo $authorObj->display_name;
?>
</a>-->
						</div>
						<div class="blogsWrapper">
							<input type="hidden" class="pageNo" value="<?php 
示例#16
0
	<div class="content">
	    
	    <?php 
if (have_posts()) {
    the_post();
}
?>

	    	<header class="archive-header">
	    		<div class="author-avatar">
	    			<?php 
echo get_avatar(get_the_author_meta('user_email'), 96);
?>
	    		</div><!-- .author-avatar -->
	    		<a href="<?php 
echo get_author_feed_link($author);
?>
" title="<?php 
_e('Subscribe to this author', 'panamazonica');
?>
" class="icon-alone feed-link"><span aria-hidden="true" data-icon="&#xf09e;"></span><span class="assistive-text"><?php 
_e('Author feed', 'panamazonica');
?>
</span></a>
	    		<h1 class="archive-title vcard">
	    			<a class="url fn n" href="<?php 
echo get_author_posts_url(get_the_author_meta('ID'));
?>
" title="<?php 
esc_attr(get_the_author());
?>
示例#17
0
 /**
  * List all the authors of the blog, with several options available.
  *
  * <ul>
  * <li>optioncount (boolean) (false): Show the count in parenthesis next to the
  * author's name.</li>
  * <li>exclude_admin (boolean) (true): Exclude the 'admin' user that is
  * installed bydefault.</li>
  * <li>show_fullname (boolean) (false): Show their full names.</li>
  * <li>hide_empty (boolean) (true): Don't show authors without any posts.</li>
  * <li>feed (string) (''): If isn't empty, show links to author's feeds.</li>
  * <li>feed_image (string) (''): If isn't empty, use this image to link to
  * feeds.</li>
  * <li>echo (boolean) (true): Set to false to return the output, instead of
  * echoing.</li>
  * <li>style (string) ('list'): Whether to display list of authors in list form
  * or as a string.</li>
  * <li>html (bool) (true): Whether to list the items in html for or plaintext.
  * </li>
  * <li>orderby (string) ('name'): The sort order of the list.</li>
  * <li>order (string) ('ASC'): Sort order for authors (either ascending or
  * descending).</li>
  * <li>number (int) (NULL): Sets the number of authors to display. This
  * causes the SQL LIMIT value to be defined. Default to no LIMIT.</li>
  * <li>min_count (int) (NULL): Sets a minimum post count threshold. Defaults to
  * no minimum.</li>
  * </ul>
  *
  * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
  * @since 1.2.0
  * @param array $args The argument array.
  * @return null|string The output, if echo is set to false.
  */
 function wp_list_authors2($args = '')
 {
     global $wpdb, $blog_id;
     $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, 'style' => 'list', 'html' => true, 'orderby' => 'name', 'order' => 'ASC', 'number' => NULL, 'min_count' => NULL);
     $r = wp_parse_args($args, $defaults);
     extract($r, EXTR_SKIP);
     $return = '';
     if (empty($id)) {
         $id = (int) $blog_id;
     }
     $blog_prefix = $wpdb->get_blog_prefix($id);
     // Order ASC or DESC based on the order and orderby arguments
     if ($show_fullname) {
         // Full names will be looked up via user meta-data and sorted later
         // order by NULL avoids the implicit sorting of the GROUP BY
         $author_sort = 'ORDER BY NULL';
     } else {
         if ($orderby == 'count') {
             $author_sort = "ORDER BY post_count {$order}, author_name";
         } else {
             $author_sort = "ORDER BY author_name {$order}";
         }
     }
     // Limit the results based on the min_count argument
     $min_count = absint($min_count);
     if ($hide_empty) {
         $min_count = max(1, $min_count);
     }
     if ($min_count) {
         $author_having = "HAVING post_count >= {$min_count}";
     } else {
         $author_having = '';
     }
     // Limit the results based on the number argument
     $number = intval($number);
     if ($number > 0) {
         $author_limit = "LIMIT {$number}";
     } else {
         $author_limit = '';
     }
     // Join to exclude authors from other blogs. Only needed if hide_empty is
     // false or and no min_count is set (the INNER JOIN to $wpdb->posts would
     // already exclude non-authors in both cases)
     if (!$hide_empty && !$min_count) {
         $author_cap_join = "JOIN {$wpdb->usermeta} AS meta_capabilities ON meta_capabilities.user_id = {$wpdb->users}.ID AND meta_capabilities.meta_key = '{$blog_prefix}capabilities'";
     } else {
         $author_cap_join = '';
     }
     $author_select = "{$wpdb->users}.ID, {$wpdb->users}.user_nicename, {$wpdb->users}.display_name AS author_name";
     // join on posts only when necessary
     if ($hide_empty || $min_count || $optioncount || $orderby == 'count') {
         $author_select .= ", COUNT({$wpdb->posts}.ID) as post_count";
         $author_posts_join = "JOIN {$wpdb->posts} ON {$wpdb->posts}.post_author = {$wpdb->users}.ID";
         $author_where = "({$wpdb->posts}.post_type = 'post' OR {$wpdb->posts}.post_type IS NULL) AND ({$wpdb->posts}.post_status = 'publish' OR {$wpdb->posts}.post_status IS NULL)";
         $author_group_by = "GROUP BY {$wpdb->users}.ID";
         // a left join is needed if we're only interested in fetching numbers of posts
         if (!$min_count && !$hide_empty) {
             $author_posts_join = 'LEFT ' . $author_posts_join;
         }
     } else {
         $author_posts_join = '';
         $author_where = '';
         $author_group_by = '';
     }
     if ($exclude_admin) {
         $author_where .= ($author_where ? ' AND ' : '') . "{$wpdb->users}.user_login <> 'admin'";
     }
     $author_where = $author_where ? 'WHERE ' . $author_where : '';
     // Query the list of users
     $sql = "\n\t\t\tSELECT {$author_select}\n\t\t\tFROM {$wpdb->users}\n\t\t\t{$author_posts_join}\n\t\t\t{$author_name_join}\n\t\t\t{$author_cap_join}\n\t\t\t{$author_where}\n\t\t\t{$author_group_by}\n\t\t\t{$author_having}\n\t\t\t{$author_sort}\n\t\t\t{$author_limit}\n\t\t\t";
     $authors = $wpdb->get_results($sql);
     if ($show_fullname) {
         // Lookup first and last name via cached user meta-data
         foreach ((array) $authors as $author) {
             $userdata = get_userdata($author->ID);
             if (!empty($userdata->first_name) || !empty($userdata->last_name)) {
                 $author->author_name = $userdata->first_name . ' ' . $userdata->last_name;
                 trim($author->author_name);
             }
         }
         // Sort the objects
         if ($orderby == 'name') {
             usort($authors, '_wp_list_authors_usort_callback_name');
         } else {
             usort($authors, '_wp_list_authors_usort_callback_count');
         }
         if ($order == 'DESC') {
             $authors = array_reverse($authors);
         }
     }
     foreach ((array) $authors as $author) {
         $link = '';
         $posts = $author->post_count;
         $name = $author->author_name;
         if (!$html) {
             if ($posts == 0) {
                 if (!$hide_empty) {
                     $return .= $name . ', ';
                 }
             } else {
                 $return .= $name . ', ';
             }
             // No need to go further to process HTML.
             continue;
         }
         if (!($posts == 0 && $hide_empty) && 'list' == $style) {
             $return .= '<li>';
         }
         if ($optioncount && $posts == 0) {
             if (!$hide_empty) {
                 $link = $name;
             }
         } else {
             $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . esc_attr(sprintf(__("Posts by %s"), $author->author_name)) . '">' . $name . '</a>';
             if (!empty($feed_image) || !empty($feed)) {
                 $link .= ' ';
                 if (empty($feed_image)) {
                     $link .= '(';
                 }
                 $link .= '<a href="' . get_author_feed_link($author->ID) . '"';
                 if (!empty($feed)) {
                     $title = ' title="' . esc_attr($feed) . '"';
                     $alt = ' alt="' . esc_attr($feed) . '"';
                     $name = $feed;
                     $link .= $title;
                 }
                 $link .= '>';
                 if (!empty($feed_image)) {
                     $link .= "<img src=\"" . esc_url($feed_image) . "\" style=\"border: none;\"{$alt}{$title}" . ' />';
                 } else {
                     $link .= $name;
                 }
                 $link .= '</a>';
                 if (empty($feed_image)) {
                     $link .= ')';
                 }
             }
             if ($optioncount) {
                 $link .= ' (' . $posts . ')';
             }
         }
         if ($posts || !$hide_empty) {
             $return .= $link . ('list' == $style ? '</li>' : ', ');
         }
     }
     $return = trim($return, ', ');
     if (!$echo) {
         return $return;
     }
     echo $return;
 }
 /**
  * Author profile and feed links
  *
  * @param $author_id
  */
 public function setup_author_urls($author_id)
 {
     $this->links[] = get_author_posts_url($author_id);
     foreach ($this->feeds as $feed) {
         $this->links[] = get_author_feed_link($author_id, $feed);
     }
 }
示例#19
0
          <div class="alignleft"><?php 
        previous_posts_link(__('&laquo; Previous', 'mystique'));
        ?>
</div>
          <div class="alignright"><?php 
        next_posts_link(__('Next &raquo;', 'mystique'));
        ?>
</div>
        </div>
        <?php 
    }
    ?>


        <?php 
    echo '<a class="rss-block alignright" rel="rss" href="' . get_author_feed_link($authordata->ID) . '">' . sprintf(__('%s\'s RSS Feed', 'mystique'), $authordata->display_name) . '</a>';
    ?>

        <?php 
} else {
    ?>
        <p><?php 
    printf(__('%s has\'t written any posts yet', 'mystique'), $authordata->display_name);
    ?>
</p>
        <?php 
}
?>


      </div>
 /**
  * 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);
 }
/**
 * Display the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args)
{
    $defaults = array('separator' => _x('&raquo;', 'feed link'), 'singletitle' => __('%1$s %2$s %3$s Comments Feed'), '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'));
    $args = wp_parse_args($args, $defaults);
    if (is_single() || is_page()) {
        $post =& get_post($id = 0);
        if (comments_open() || pings_open() || $post->comment_count > 0) {
            $title = esc_attr(sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html(get_the_title())));
            $href = get_post_comments_feed_link($post->ID);
        }
    } elseif (is_category()) {
        $cat_id = intval(get_query_var('cat'));
        $title = esc_attr(sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], get_cat_name($cat_id)));
        $href = get_category_feed_link($cat_id);
    } elseif (is_tag()) {
        $tag_id = intval(get_query_var('tag_id'));
        $tag = get_tag($tag_id);
        $title = esc_attr(sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $tag->name));
        $href = get_tag_feed_link($tag_id);
    } elseif (is_author()) {
        $author_id = intval(get_query_var('author'));
        $title = esc_attr(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 = esc_attr(sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query()));
        $href = get_search_feed_link();
    }
    if (isset($title) && isset($href)) {
        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . $title . '" href="' . $href . '" />' . "\n";
    }
}
示例#22
0
    ?>
		<div class="page-head">

			<h2 class="page-title">
				<?php 
    printf(__('Author Archives: %s', 'tie'), get_the_author());
    ?>
			</h2>
			<?php 
    if (tie_get_option('author_rss')) {
        ?>
			<a class="rss-cat-icon ttip" title="<?php 
        _e('Feed Subscription', 'tie');
        ?>
"  href="<?php 
        echo get_author_feed_link(get_the_author_meta('ID'));
        ?>
"><?php 
        _e('Feed Subscription', 'tie');
        ?>
</a>

			<?php 
    }
    ?>
			<div class="stripe-line"></div>
			
			<?php 
    if (tie_get_option('author_bio')) {
        ?>
			<div class="author-bio">
示例#23
0
 /**
  * Post author; feed link variations.
  *
  * @since 150218 Refactoring cache clear/purge routines.
  *
  * @param \WP_Post A WordPress post class instance.
  *
  * @return array An array of all feed link variations.
  */
 public function post_author_feed_link_variations(\WP_Post $post)
 {
     $variations = array();
     // Initialize.
     foreach ($this->feed_types as $_feed_type) {
         $variations[] = get_author_feed_link($post->post_author, $_feed_type);
     }
     if ($this->seo_friendly_permalinks && ($post_author = get_userdata($post->post_author))) {
         foreach ($this->feed_types as $_feed_type) {
             $variations[] = add_query_arg(urlencode_deep(array('author' => $post->post_author)), $this->home_url . 'feed/' . urlencode($_feed_type) . '/');
             $variations[] = add_query_arg(urlencode_deep(array('author' => $post_author->user_nicename)), $this->home_url . 'feed/' . urlencode($_feed_type) . '/');
         }
     }
     unset($_feed_type);
     // Housekeeping.
     return $variations;
 }
 /**
  * Vrátí permalink na požadovaný nebo výchozí (RSS) feed podle aktuálního uživatele (ID)
  * 
  * @author Martin Hlaváč
  * @link http://www.ktstudio.cz
  * 
  * @param string $feed
  * @return mixed string|null
  */
 public function getCurrentUserFeedLink($feed = "")
 {
     $id = $this->getCurrentUserId();
     if (KT::isIdFormat($id)) {
         return get_author_feed_link($id, $feed);
     }
     return null;
 }
	/**
	 * @ticket 26538
	 */
	function test_wp_list_authors_feed_type() {
		$url0 = get_author_feed_link( $this->users[0], 'atom' );
		$url1 = get_author_feed_link( $this->users[1], 'atom' );
		$url2 = get_author_feed_link( $this->users[2], 'atom' );
		$expected['feed_type'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>';
		$this->AssertEquals( $expected['feed_type'], wp_list_authors( array( 'echo' => false, 'feed' => 'link to feed', 'feed_type' => 'atom' ) ) );
	}
示例#26
0
function p2_get_author_feed_link()
{
    global $author;
    return apply_filters('p2_get_author_feed_link', get_author_feed_link($author->ID));
}
示例#27
0
/**
 * Display the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args = array())
{
    $defaults = array('separator' => _x('&raquo;', 'feed link'), 'singletitle' => __('%1$s %2$s %3$s Comments Feed'), '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_singular()) {
        $id = 0;
        $post = get_post($id);
        if (comments_open() || pings_open() || $post->comment_count > 0) {
            $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
            $href = get_post_comments_feed_link($post->ID);
        }
    } elseif (is_post_type_archive()) {
        $post_type = get_query_var('post_type');
        if (is_array($post_type)) {
            $post_type = reset($post_type);
        }
        $post_type_obj = get_post_type_object($post_type);
        $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
        $href = get_post_type_archive_feed_link($post_type_obj->name);
    } elseif (is_category()) {
        $term = get_queried_object();
        if ($term) {
            $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();
        if ($term) {
            $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));
        $post_type_obj = get_queried_object();
        if ($post_type_obj) {
            $href = get_post_type_archive_feed_link($post_type_obj->name);
        }
    }
    if (isset($title) && isset($href)) {
        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n";
    }
}
示例#28
0
function p2_get_author_feed_link()
{
    $author_id = get_queried_object_id();
    if (isset($author_id)) {
        return apply_filters('p2_get_author_feed_link', get_author_feed_link($author_id));
    }
}
示例#29
0
/**
 * Print/Return link to author RSS feed.
 *
 * @since 1.2
 * @deprecated 2.5
 * @deprecated Use get_author_feed_link()
 * @see get_author_feed_link()
 *
 * @param bool $echo
 * @param int $author_id
 * @return string|null
 */
function get_author_rss_link($echo = false, $author_id = 1)
{
    _deprecated_function(__FUNCTION__, '2.5', 'get_author_feed_link()');
    $link = get_author_feed_link($author_id);
    if ($echo) {
        echo $link;
    }
    return $link;
}
</foaf:firstName>
				<foaf:surname><?php 
    echo htmlspecialchars($authordata->user_lastname);
    ?>
</foaf:surname>
				<foaf:nick><?php 
    echo htmlspecialchars($authordata->nickname);
    ?>
</foaf:nick>
				<foaf:email><?php 
    echo $authordata->user_email;
    ?>
</foaf:email>
				<foaf:weblog rdf:resource="<?php 
    echo htmlspecialchars(get_author_posts_url($authordata->ID, $authordata->user_nicename));
    ?>
"/>
				<rdfs:seeAlso>
					<foaf:PersonalProfileDocument rdf:about="<?php 
    echo htmlspecialchars(get_author_feed_link($authordata->ID, 'foaf'));
    ?>
"/>
				</rdfs:seeAlso>
			</foaf:Person>
		</foaf:member>
		<?php 
}
?>
	</foaf:Group>
</rdf:RDF>