本文整理汇总了PHP中get_the_author_ID函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_author_ID函数的具体用法?PHP get_the_author_ID怎么用?PHP get_the_author_ID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_the_author_ID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_author_avatar
function get_author_avatar()
{
global $default;
$avatar = '';
if (class_exists('author_image')) {
$avatar = author_image::get();
}
if ($avatar == '') {
if (in_the_loop()) {
$author_id = get_the_author_ID();
} elseif (is_singular()) {
global $wp_the_query;
$author_id = $wp_the_query->posts[0]->post_author;
} elseif (is_author()) {
global $wp_the_query;
$author_id = $wp_the_query->get_queried_object_id();
}
$author = get_userdata($author_id);
if (!empty($author)) {
$avatar = get_avatar($author->user_email, 64, $default, $author->display_name);
} else {
$avatar = '<img src="' . esc_url($default) . '" alt="' . $author->display_name . '" />';
}
}
return $avatar;
}
示例2: be_author_box
/**
* Load Author Boxes
*
* @author Bill Erickson
* @link http://www.billerickson.net/wordpress-post-multiple-authors/
*/
function be_author_box()
{
if (!is_single()) {
return;
}
if (function_exists('get_coauthors')) {
$authors = get_coauthors();
foreach ($authors as $author) {
be_do_author_box($author->data->ID);
}
} else {
be_do_author_box(get_the_author_ID());
}
}
示例3: get_image
function get_image($field, $width)
{
$image = get_newspapermeta($field, 0);
if (!empty($image)) {
if ($_SERVER['SERVER_NAME'] == 'localhost') {
echo $image . '" width="' . $width . 'px"';
} else {
preg_match('/[0-9]{4}\\/[0-9]{2}\\/.+\\.jpg/', $image, $matches);
$image_scaled = get_bloginfo('url') . '/t/i/' . $width . '/' . $matches[0];
echo $image_scaled . '" width="' . $width . 'px"';
}
} else {
echo get_bloginfo('url') . '/wp-content/themes/fokus/images/portraits/' . $width . '/' . get_the_author_ID() . '.jpg"';
}
echo '"alt="';
the_title_attribute();
echo '"';
}
示例4: cfct_choose_single_template
function cfct_choose_single_template($files = array(), $filter = '*')
{
// must be called within the_loop - cfct_choose_general_template_single() approximates a loop for this reason.
$exec_order = array('author', 'meta', 'category', 'role', 'tag', 'parent', 'default');
$exec_order = apply_filters('cfct_single_match_order', $exec_order);
$filename = false;
global $post;
foreach ($exec_order as $type) {
switch ($type) {
case 'author':
$author_files = cfct_author_templates('', $files);
if (count($author_files)) {
$author = get_the_author_login();
$file = cfct_filename_filter('author-' . $author . '.php', $filter);
if (in_array($file, $author_files)) {
$filename = $file;
}
}
break;
case 'meta':
$meta_files = cfct_meta_templates('', $files);
if (count($meta_files)) {
$meta = get_post_custom($post->ID);
if (count($meta)) {
// check key, value matches first
foreach ($meta as $k => $v) {
$val = $v[0];
$file = cfct_filename_filter('meta-' . $k . '-' . $val . '.php', $filter);
if (in_array($file, $meta_files)) {
$filename = $file;
break;
}
}
// check key matches only
if (!$filename) {
foreach ($meta as $k => $v) {
$file = cfct_filename_filter('meta-' . $k . '.php', $filter);
if (in_array($file, $meta_files)) {
$filename = $file;
break;
}
}
}
}
}
break;
case 'category':
$cat_files = cfct_cat_templates($type, $files);
if (count($cat_files)) {
foreach ($cat_files as $file) {
$cat_id = cfct_cat_filename_to_id($file);
if (in_category($cat_id)) {
$filename = $file;
break;
}
}
}
break;
case 'role':
$role_files = cfct_role_templates($type, $files);
if (count($role_files)) {
$user = new WP_User(get_the_author_ID());
if (count($user->roles)) {
foreach ($role_files as $file) {
foreach ($user->roles as $role) {
if (cfct_role_filename_to_name($file) == $role) {
$filename = $file;
break;
}
}
}
}
}
break;
case 'tag':
$tag_files = cfct_tag_templates($type, $files);
if (count($tag_files)) {
$tags = get_the_tags($post->ID);
if (is_array($tags) && count($tags)) {
foreach ($tag_files as $file) {
foreach ($tags as $tag) {
if ($tag->slug == cfct_tag_filename_to_name($file)) {
$filename = $file;
break;
}
}
}
}
}
break;
case 'parent':
$parent_files = cfct_parent_templates($type, $files);
if (count($parent_files) && $post->post_parent > 0) {
$parent = cfct_post_id_to_slug($post->post_parent);
$file = cfct_filename_filter('parent-' . $parent . '.php', $filter);
if (in_array($file, $parent_files)) {
$filename = $file;
}
}
break;
//.........这里部分代码省略.........
示例5: while
?>
">RSS</a></h2>
<ul>
<?php
if (have_posts()) {
$previous_user_id = 0;
while (have_posts()) {
the_post();
?>
<li>
<?php
// Don't show the avatar if the previous post was by the same user
$current_user_id = get_the_author_ID();
if ($previous_user_id !== $current_user_id) {
echo prologue_get_avatar($current_user_id, get_the_author_email(), 48);
}
$previous_user_id = $current_user_id;
?>
<h4>
<?php
the_author_posts_link();
?>
<span class="meta">
<?php
the_time("h:i:s a");
?>
on <?php
示例6: md5
$email_md5 = md5(get_the_author_email());
$default_img = urlencode('http://use.perl.org/images/pix.gif');
?>
<div class="sleeve_main">
<div id="postpage">
<div id="main">
<ul id="postlist">
<li>
<h2 class="title">
<?php
the_title();
?>
</h2>
<h4>
<?php
echo prologue_get_avatar(get_the_author_ID(), get_the_author_email(), 48);
?>
<?php
the_author_posts_link();
?>
<span class="meta">
<?php
the_time();
?>
<em>on</em> <?php
the_time('F j, Y');
?>
|
<?php
comments_number(__('0'), __('1'), __('%'));
示例7: get_avatar
</a></h2>
</div>
<div class="col-5 last">
<div class="media mhn mtl ptm">
<div class="img-ext mlm">
<?php
echo get_avatar(get_the_author_id(), 38);
?>
</div>
<div class="bd font-small tar" style="display: block;">
<?php
the_time('F jS, Y');
?>
<br />
<?php
printf('<a class="wplnk-bold" href="' . get_author_posts_url(get_the_author_ID()) . '" title="' . sprintf(__("Posts by %s", "uxebu"), attribute_escape(get_the_author())) . ' ">' . get_the_author() . '</a>');
?>
</div>
</div><!-- end media -->
</div><!-- end col -->
</div><!-- end hd -->
<div class="bd">
<?php
the_content('read more...');
?>
<!--<?php
trackback_rdf();
?>
-->
</div><!-- end bd -->
示例8: the_author_url
/**
* @package WordPress
* @subpackage HivistaSoft_Theme
*/
?>
<div id="sidebar">
<?php
if (is_singular()) {
?>
<div class="widget-container">
<div class="box-author">
<a href="<?php
the_author_url();
?>
" target="_blank"><?php
echo get_avatar(get_the_author_ID(), 70);
?>
</a>
<div class="info">
<span>About the author:</span>
<p><?php
echo short_content(get_the_author_meta('description'), 70, '(...)');
?>
</p>
</div>
</div>
</div>
<?php
}
?>
<?php
示例9: _e
?>
" rel="bookmark" title="<?php
_e('Permanent Link:', 'fusion');
echo ' ';
the_title_attribute();
?>
"><?php
the_title();
?>
</a></h3>
<!-- story header -->
<div class="postheader">
<div class="postinfo">
<p>
<?php
printf(__('Posted by %s in %s on %s', 'fusion'), '<a href="' . get_author_posts_url(get_the_author_ID()) . '" title="' . sprintf(__("Posts by %s", "fusion"), attribute_escape(get_the_author())) . ' ">' . get_the_author() . '</a>', get_the_category_list(', '), get_the_time(__('F jS, Y', 'fusion')));
?>
<span class="editlink"><?php
edit_post_link('');
?>
</span></p>
</div>
</div>
<!-- /story header -->
<div class="postbody entry clearfix">
<?php
if (get_option('fusion_indexposts') == 'excerpt') {
the_excerpt();
} else {
the_content(__('Read the rest of this entry »', 'fusion'));
}
示例10: wpi_template_comment_trackback
function wpi_template_comment_trackback($post, $comment, $cnt)
{
$author_id = get_the_author_ID();
$wauthor_name = wpi_get_comment_author();
$author_uri = get_comment_author_url();
$author_uri = $author_uri != '' && $author_uri != 'http://' ? $author_uri : get_permalink($post->ID) . '#comment-' . get_comment_ID();
$microid = wpi_get_microid_hash(get_comment_author_email(), $author_uri);
?>
<li id="comment-<?php
comment_ID();
?>
" class="<?php
wpi_comment_root_class($cnt, get_comment_author());
?>
">
<ul class="reviewier-column cf r">
<li class="span-1 fl">
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="<?php
the_permalink();
?>
#comment-<?php
comment_ID();
?>
">
<license rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
</License>
</rdf:RDF>
-->
</li>
<li class="<?php
wpi_comment_content_width();
?>
fl review-content dc-source">
<dl class="review r cf">
<dt class="item title summary ox">
<a rel="dc:source robots-anchortext" href="#comment-<?php
comment_ID();
?>
" class="url fn" title="<?php
the_title();
?>
">permalink</a>
</dt>
<dd class="reviewer-meta vcard microid-<?php
echo $microid;
?>
db"> <span class="note dn"><?php
the_title();
?>
</span>
<a href="<?php
wpi_curie_url($author_uri);
?>
" class="url fn reviewer" rel="contact noarchive robots-noarchive" title="<?php
attribute_escape($wauthor_name);
?>
">
<strong class="org" style="background-image:url('<?php
echo wpi_comment_pingback_favicon($comment);
?>
')">
<?php
echo $wauthor_name;
?>
</strong>
</a>
<abbr class="dtreviewed" title="<?php
comment_date('Y-m-dTH:i:s:Z');
?>
">
<?php
wpi_comment_date();
?>
</abbr>
<span class="rating dn">3</span>
<span class="type dn">url</span>
<?php
edit_comment_link(__('edit', WPI_META), '· <span class="edit-comment">', '</span>');
?>
</dd>
<dd class="reviewer-entry">
<div class="description">
<p class="br rn r">
<?php
//.........这里部分代码省略.........
示例11: get_posts
/**
* Gets posts, based on the params provided
*
* @package Invite Anyone
* @since 0.9
*/
function get_posts()
{
global $wpdb;
// $posts is a multidimensional array, containing all different time periods
$posts = array();
foreach ($this->time_periods as $tp => $period) {
$invite = new Invite_Anyone_Invitation();
// Will be populated out of $this->params. Defaults to none?
$args = array('posts_per_page' => '-1', 'status' => 'pending,draft,future,publish,trash');
// Create the date filter
if ($tp) {
$since = time() - $tp;
$this->date_sql = $wpdb->prepare(" AND post_date > %s", date('Y-m-d H:i:s', $since));
add_filter('posts_where_paged', array($this, 'where_filter'));
}
$invites = $invite->get($args);
// Remove the filter
if ($tp) {
remove_filter('posts_where_paged', array($this, 'where_filter'));
}
$period['total_count'] = 0;
$period['accepted_count'] = 0;
$period['total_count_cs'] = 0;
$period['accepted_count_cs'] = 0;
$period['unique_emails'] = 0;
$period['unique_inviters'] = 0;
$period['unique_emails'] = array();
$period['unique_inviters'] = array();
if ($invites->have_posts()) {
while ($invites->have_posts()) {
$invites->the_post();
// Increase the total count
$period['total_count']++;
$author_key = get_the_author_ID();
// If it's a new sender, add them to $unique_inviters
if (!isset($period['unique_inviters'][$author_key])) {
$period['unique_inviters'][$author_key] = array('overall' => array('sent' => 0, 'accepted' => 0), 'cloudsponge' => array('sent' => 0, 'accepted' => 0));
}
// Bump the inviter's count
$period['unique_inviters'][$author_key]['overall']['sent']++;
// Is it accepted?
$accepted = get_post_meta(get_the_ID(), 'bp_ia_accepted', true);
if ($accepted) {
// Total accepted count
$period['accepted_count']++;
// Author's accepted count
$period['unique_inviters'][$author_key]['overall']['accepted']++;
}
// Is it a CloudSponge invite?
$is_cloudsponge = get_post_meta(get_the_ID(), 'bp_ia_is_cloudsponge', true);
if (__('Yes', 'invite-anyone') == $is_cloudsponge) {
$period['total_count_cs']++;
// Author count
$period['unique_inviters'][$author_key]['cloudsponge']['sent']++;
if ($accepted) {
// Total accepted count
$period['accepted_count_cs']++;
// Author's accepted count
$period['unique_inviters'][$author_key]['cloudsponge']['accepted']++;
}
}
}
}
// With all the data tallied, we can come up with some percentages
// Overall acceptance rate
if ($period['total_count']) {
$period['acceptance_rate'] = round($period['accepted_count'] / $period['total_count'] * 100);
$period['acceptance_rate'] .= '%';
} else {
$period['acceptance_rate'] = __('n/a', 'invite-anyone');
}
// CS percentage
if ($period['total_count']) {
$period['cs_percentage'] = round($period['total_count_cs'] / $period['total_count'] * 100);
$period['cs_percentage'] .= '%';
} else {
$period['cs_percentage'] = __('n/a', 'invite-anyone');
}
// CS acceptance rate
if ($period['total_count_cs']) {
$period['acceptance_rate_cs'] = round($period['accepted_count_cs'] / $period['total_count_cs'] * 100);
$period['acceptance_rate_cs'] .= '%';
} else {
$period['acceptance_rate_cs'] = __('n/a', 'invite-anyone');
}
// Find the most active user
$leader_user_id_pct = 0;
$leader_val_pct = 0;
$leader_user_id_num = 0;
$leader_val_num = 0;
$leader_user_id_pct_cs = 0;
$leader_val_pct_cs = 0;
$leader_user_id_num_cs = 0;
$leader_val_num_cs = 0;
//.........这里部分代码省略.........
示例12: sa_entry_author
function sa_entry_author()
{
return '<span class="vcard author entry-author"><a href="' . get_author_posts_url(get_the_author_ID()) . '" class="url fn" title="' . sprintf('View all posts by %s', esc_attr(get_the_author())) . '">' . get_the_author() . '</a></span>';
}
示例13: get_header
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();
?>
<a class="rss" href="<?php
echo $author_feed_url;
示例14: queryposts
function queryposts($atts)
{
extract(shortcode_atts(array('category_id' => '', 'category_name' => '', 'tag' => '', 'day' => '', 'month' => '', 'year' => '', 'count' => '5', 'author_id' => '', 'author_name' => '', 'order_by' => 'date'), $atts));
$output = '';
$query = array();
if ($category_id != '') {
$query[] = 'cat=' . $category_id;
}
if ($category_name != '') {
$query[] = 'category_name=' . $category_name;
}
if ($tag != '') {
$query[] = 'tag=' . $tag;
}
if ($day != '') {
$query[] = 'day=' . $day;
}
if ($month != '') {
$query[] = 'monthnum=' . $month;
}
if ($year != '') {
$query[] = 'year=' . $year;
}
if ($count) {
$query[] = 'posts_per_page=' . $count;
}
if ($author_id != '') {
$query[] = 'author=' . $author_id;
}
if ($author_name != '') {
$query[] = 'author_name=' . $author_name;
}
if ($order_by) {
$query[] = 'orderby=' . $order_by;
}
$posts = new WP_Query(implode('&', $query));
while ($posts->have_posts()) {
$posts->the_post();
$output .= '<div class="post">';
$output .= '<div class="post-header"><h3 class="post-title"><a href="' . get_permalink() . '" rel="bookmark" title="' . __('Permanent Link:', 'arclite') . ' ' . get_the_title() . '">' . get_the_title() . '</a></h3>';
$output .= '<p class="post-date"><span class="month">' . get_the_time(__('M', 'arclite')) . '</span><span class="day">' . get_the_time(__('j', 'arclite')) . '</span></p>';
$output .= '<p class="post-author"><span class="info">' . sprintf(__('Posted by %s in %s', 'arclite'), '<a href="' . get_author_posts_url(get_the_author_ID()) . '" title="' . sprintf(__("Posts by %s", "arclite"), attribute_escape(get_the_author())) . ' ">' . get_the_author() . '</a>', get_the_category_list(', ')) . ' | ';
if (comments_open()) {
// global $id, $comment;
$comments_number = get_comments_number();
$output .= '<a href="' . get_permalink() . '#comments" class="';
if ($comments_number == 0) {
$output .= 'no ';
}
$output .= 'comments">';
if ($comments_number > 1) {
$output .= sprintf(__('%s comments'), $comments_number);
} else {
if ($comments_number == 1) {
$output .= __('1 comment');
} else {
$output .= __('No comments');
}
}
$output .= '</a>';
} else {
$output .= __("Comments Off", "arclite");
}
$output .= '</span></p></div>';
$output .= '<div class="post-content clearfix">';
$post_preview = get_arclite_option('post_preview');
if ($post_preview == 'excerpt') {
$output .= get_the_excerpt();
} else {
$output .= get_the_content(__('Read the rest of this entry »', 'arclite'));
}
$output .= '</div>';
$post_tags = get_the_tags();
if ($post_tags) {
$output .= '<p class="tags">';
$tags = array();
$i = 0;
foreach ($post_tags as $tag) {
$tags[$i] .= '<a href="' . get_tag_link($tag->term_id) . '" rel="tag" title="' . sprintf(__('%s (%s topics)'), $tag->name, $tag->count) . '">' . $tag->name . '</a>';
$i++;
}
$output .= implode(', ', $tags);
$output .= '</p>';
}
$output .= '</div>';
}
return $output;
}
示例15: cfct_banner
Australis Media Pty Ltd has made the contents of this file
available under a CC-GNU-GPL license:
http://creativecommons.org/licenses/GPL/2.0/
A copy of the full license can be found as part of this
distribution in the file LICENSE.TXT
You may use the Vanilla theme software in accordance with the
terms of that license. You agree that you are solely responsible
for your use of the Vanilla theme software and you represent and
warrant to Australis Media Pty Ltd that your use of the Vanilla
theme software will comply with the CC-GNU-GPL.
*/
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
die;
}
if (CFCT_DEBUG) {
cfct_banner(__FILE__);
}
global $previousday, $authordata, $tpl;
$previousday = -1;
$tpl_tags_list = get_the_tag_list("", ",", "");
$tpl_edit_link = get_edit_post_link();
$tpl_pages_link = wp_link_pages('before=&after=&echo=0');
$content = get_the_content('<span class="more-link">' . __('Continued...', 'carrington') . '</span>');
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$tpl["content"] = array("tpl_file" => "content-default.html");
$tpl["entries"][] = array("id" => get_the_ID(), "class" => sandbox_post_class(false), "permalink" => get_permalink(), "title_attribute" => the_title_attribute('echo=0'), "title" => the_title("", "", false), "content" => $content, "pages_link" => $tpl_pages_link == '' ? false : $tpl_pages_link, "categories_list" => get_the_category_list(', '), "tags_list" => $tpl_tags_list == '' ? false : $tpl_tags_list, "author" => array("link" => get_author_link(false, get_the_author_ID(), $authordata->user_nicename), "name_attribute" => attribute_escape($authordata->display_name), "name" => get_the_author()), "date_time" => get_the_time('Y-m-d\\TH:i:sO'), "date" => the_date("", "", "", false), "comments_link" => vanilla_comments_popup_link(__('No comments', 'carrington'), __('1 comment', 'carrington'), __('% comments', 'carrington')), "edit_link" => $tpl_edit_link == '' ? false : $tpl_edit_link, "edit_link_text" => __('Edit This', 'carrington'));