本文整理汇总了PHP中is_author函数的典型用法代码示例。如果您正苦于以下问题:PHP is_author函数的具体用法?PHP is_author怎么用?PHP is_author使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_author函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: presscore_search_title_shortcode
function presscore_search_title_shortcode()
{
$title = '';
$wrap_class = '';
if (is_search()) {
$title = get_search_query();
} else {
if (is_archive()) {
if (is_category()) {
$title = single_cat_title('', false);
} elseif (is_tag()) {
$title = single_tag_title('', false);
} elseif (is_author()) {
the_post();
$title = '<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a>';
$wrap_class .= ' vcard';
rewind_posts();
} elseif (is_day()) {
$title = '<span>' . get_the_date() . '</span>';
} elseif (is_month()) {
$title = '<span>' . get_the_date('F Y');
} elseif (is_year()) {
$title = '<span>' . get_the_date('Y');
} elseif (is_tax('dt_portfolio_category')) {
$title = single_term_title('', false);
} elseif (is_tax('dt_gallery_category')) {
$title = single_term_title('', false);
}
}
}
if ($title) {
$title = '<span' . ($wrap_class ? ' class="' . esc_attr($wrap_class) . '"' : '') . '>' . $title . '</span>';
}
return $title;
}
示例2: xfac_get_avatar
function xfac_get_avatar($avatar = '', $id_or_email, $size = 96, $default = '', $alt = '')
{
if (is_numeric($id_or_email)) {
$wpUserId = (int) $id_or_email;
} elseif (is_string($id_or_email) && ($user = get_user_by('email', $id_or_email))) {
$wpUserId = $user->ID;
} elseif (is_object($id_or_email) && !empty($id_or_email->user_id)) {
$wpUserId = (int) $id_or_email->user_id;
}
if (empty($wpUserId)) {
// cannot figure out the user id...
return $avatar;
}
$apiRecords = xfac_user_getRecordsByUserId($wpUserId);
if (empty($apiRecords)) {
// no api records
return $avatar;
}
$apiRecord = reset($apiRecords);
if (empty($apiRecord->profile['links']['avatar'])) {
// no avatar?
return $avatar;
}
$avatar = $apiRecord->profile['links']['avatar'];
$size = (int) $size;
if (empty($alt)) {
$alt = get_the_author_meta('display_name', $wpUserId);
}
$author_class = is_author($wpUserId) ? ' current-author' : '';
$avatar = "<img alt='" . esc_attr($alt) . "' src='" . esc_url($avatar) . "' class='avatar avatar-{$size}{$author_class} photo' height='{$size}' width='{$size}' />";
return $avatar;
}
示例3: widget_author_info_card
function widget_author_info_card($args)
{
if (get_query_var('author_name')) {
$curauth = get_userdatabylogin(get_query_var('author_name'));
} else {
$curauth = get_userdata(get_query_var('author'));
}
extract($args);
echo $before_widget . $before_title;
// If its the author page.
if (get_option('sa_add_to_author_page') == 'yes' && is_author()) {
$title = $curauth->display_name;
echo $title . $after_title;
echo sa_author_info_card($curauth);
} else {
$title = "List of Authors";
echo $title . $after_title;
ob_start();
wp_list_authors('show_fullname=1&optioncount=1');
$author_list = ob_get_contents();
ob_end_clean();
echo "<ul>{$author_list}</ul>";
}
echo $after_widget;
}
示例4: semifolio_filter_wp_title
function semifolio_filter_wp_title($old_title, $sep, $sep_location)
{
// add padding to the sep
$ssep = ' ' . $sep . ' ';
// find the type of index page this is
if (is_category()) {
$insert = $ssep . __('Category', 'slaves');
} elseif (is_tag()) {
$insert = $ssep . __('Tag', 'slaves');
} elseif (is_author()) {
$insert = $ssep . __('Author', 'slaves');
} elseif (is_year() || is_month() || is_day()) {
$insert = $ssep . __('Archives', 'slaves');
} elseif (is_home()) {
$insert = $ssep . bloginfo('description');
} else {
$insert = NULL;
}
// get the page number we're on (index)
if (get_query_var('paged')) {
$num = $ssep . __('Page ', 'slaves') . get_query_var('paged');
} elseif (get_query_var('page')) {
$num = $ssep . __('Page ', 'slaves') . get_query_var('page');
} else {
$num = NULL;
}
// concoct and return new title
return bloginfo('name') . $insert . $old_title . $num;
}
示例5: display
/**
* Display breadcrumbs
*/
public function display()
{
if (Habakiri::get('is_displaying_bread_crumb') === 'false') {
return;
}
global $wp_query;
// Set to home
$home_label = $this->get_home_label();
$this->set($home_label, home_url('/'));
// Set to blog
$post_type = $this->get_post_type();
if (is_category() || is_tag() || is_date() || is_author() || is_single() && $post_type === 'post') {
$show_on_front = get_option('show_on_front');
$page_for_posts = get_option('page_for_posts');
if ($show_on_front === 'page' && $page_for_posts) {
$this->set(get_the_title($page_for_posts), get_permalink($page_for_posts));
}
}
// Set current and ancestors
if (is_404()) {
$this->set_for_404();
} elseif (is_search()) {
$this->set_for_search();
} elseif (is_tax()) {
$this->set_for_tax();
} elseif (is_attachment()) {
$this->set_for_attachment();
} elseif (is_page() && !is_front_page()) {
$this->set_for_page();
} elseif (is_post_type_archive()) {
$this->set_for_post_type_archive();
} elseif (is_single()) {
$this->set_for_single();
} elseif (is_category()) {
$this->set_for_category();
} elseif (is_tag()) {
$this->set_for_tag();
} elseif (is_author()) {
$this->set_for_author();
} elseif (is_day()) {
$this->set_for_day();
} elseif (is_month()) {
$this->set_for_month();
} elseif (is_year()) {
$this->set_for_year();
} elseif (is_home() && !is_front_page()) {
$this->set_for_blog();
}
$bread_crumb = array();
$last_item = array_pop($this->bread_crumb);
foreach ($this->bread_crumb as $_bread_crumb) {
if (!empty($_bread_crumb['link'])) {
$bread_crumb[] = sprintf('<a href="%s">%s</a>', esc_url($_bread_crumb['link']), esc_html($_bread_crumb['title']));
} else {
$bread_crumb[] = esc_html($_bread_crumb['title']);
}
}
$bread_crumb[] = sprintf('<strong>%s</strong>', $last_item['title']);
printf('<div class="breadcrumbs">%s</div>', implode(' > ', apply_filters('habakiri_bread_crumb', $bread_crumb)));
}
示例6: get_index_headline
function get_index_headline()
{
if (is_home()) {
$index_headline = 'Blog Index';
} else {
if (is_category()) {
$category = single_term_title("", false);
$index_headline = 'Archives for the "' . $category . '" Category';
} elseif (is_tag()) {
$tag = single_term_title("", false);
$index_headline = 'Archives for the "' . $tag . '" Category';
} elseif (is_day()) {
$index_headline = 'Archive for ' . get_the_time('F jS, Y');
} elseif (is_month()) {
$index_headline = 'Archive for ' . get_the_time('F Y');
} elseif (is_year()) {
$index_headline = 'Archive for ' . get_the_time('Y');
} elseif (is_author()) {
$index_headline = 'Author Archive';
} else {
$index_headline = 'Blog Archives';
}
}
return $index_headline;
}
示例7: rcl_messages_scripts
function rcl_messages_scripts()
{
global $user_ID, $rcl_options, $post, $wpdb;
if (isset($rcl_options['notify_message']) && $rcl_options['notify_message']) {
return false;
}
wp_enqueue_script('jquery');
$glup = $rcl_options['global_update_private_message'];
if (!$glup) {
$new_mess = $wpdb->get_row($wpdb->prepare("SELECT ID FROM " . RCL_PREF . "private_message WHERE adressat_mess = '%d' AND status_mess = '0' OR adressat_mess = '%d' AND status_mess = '4'", $user_ID, $user_ID));
} else {
$new_mess = true;
}
if ($new_mess) {
$scr = false;
if ($rcl_options['view_user_lk_rcl'] == 1) {
$get = 'user';
if ($rcl_options['link_user_lk_rcl'] != '') {
$get = $rcl_options['link_user_lk_rcl'];
}
if (isset($_GET[$get]) && $user_ID == $_GET[$get] || $rcl_options['lk_page_rcl'] != $post->ID) {
$scr = true;
}
} else {
if (!is_author() || is_author($user_ID)) {
$scr = true;
}
}
if ($scr) {
wp_enqueue_script('newmess_recall', plugins_url('js/new_mess.js', __FILE__));
}
}
}
示例8: isCptArchive
/**
* Test to see if the page is a date based archive page cpt archive
*
* @since 1.0.0
* @access public
* @param
* @return boolean
*/
public function isCptArchive()
{
if (is_category() || is_author() || is_tag() || is_date() || is_front_page() || is_home()) {
return false;
}
return true;
}
示例9: quindo_get_alm_options_front
function quindo_get_alm_options_front($offset)
{
$alm_options = quindo_get_alm_options();
if ($offset) {
$alm_options['offset'] = $offset;
}
if (is_category()) {
$alm_options['category'] = get_category(get_query_var('cat'))->slug;
}
if (is_year() || is_month() || is_day()) {
$alm_options['year'] = get_the_time('Y');
}
if (is_month() || is_day()) {
$alm_options['month'] = get_the_time('n');
}
if (is_day()) {
$alm_options['day'] = get_the_time('j');
}
if (is_author()) {
$alm_options['author'] = get_user_by('slug', get_query_var('author_name'))->ID;
}
if (is_search()) {
$alm_options['search'] = get_query_var('s');
}
$alm_options_imploded = '';
foreach ($alm_options as $option => $value) {
$alm_options_imploded .= ' ' . $option . '="' . $value . '"';
}
return $alm_options_imploded;
}
示例10: getWpTemplate
function getWpTemplate()
{
if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
$template = false;
if (is_404() && ($template = get_404_template())) {
} elseif (is_search() && ($template = get_search_template())) {
} elseif (is_tax() && ($template = get_taxonomy_template())) {
} elseif (is_front_page() && ($template = get_front_page_template())) {
} elseif (is_home() && ($template = get_home_template())) {
} elseif (is_attachment() && ($template = get_attachment_template())) {
} elseif (is_single() && ($template = get_single_template())) {
} elseif (is_page() && ($template = get_page_template())) {
} elseif (is_category() && ($template = get_category_template())) {
} elseif (is_tag() && ($template = get_tag_template())) {
} elseif (is_author() && ($template = get_author_template())) {
} elseif (is_date() && ($template = get_date_template())) {
} elseif (is_archive() && ($template = get_archive_template())) {
} elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
} elseif (is_paged() && ($template = get_paged_template())) {
} else {
$template = get_index_template();
}
return str_replace(ABSPATH, '', $template);
} else {
return null;
}
}
示例11: mh_page_title
function mh_page_title()
{
if (is_home()) {
echo get_the_title(get_option('page_for_posts', true));
} elseif (is_author()) {
global $author;
$user_info = get_userdata($author);
echo __('Articles by ', 'mh') . esc_attr($user_info->display_name);
} elseif (is_category() || is_tax()) {
echo single_cat_title("", false);
} elseif (is_tag()) {
echo single_tag_title("", false);
} elseif (is_search()) {
echo __('Search Results for ', 'mh') . get_search_query();
} elseif (is_day()) {
echo get_the_date();
} elseif (is_month()) {
echo get_the_date('F Y');
} elseif (is_year()) {
echo get_the_date('Y');
} elseif (is_404()) {
echo __('Page not found (404)', 'mh');
} else {
echo get_the_title();
}
}
示例12: ubik_seo_meta_description
function ubik_seo_meta_description($desc = '')
{
// Generate a meta description
if (empty($desc)) {
// Single posts, pages, and attachments
if (is_singular()) {
$post = get_post();
if (empty($post)) {
$desc = '';
}
$desc = wptexturize($post->post_content);
// Get the entire contents, not the excerpt, so as to not duplicate Ubik Excerpt
}
// Check to see if we have a description for this category, tag, or taxonomy
if (is_category() || is_tag() || is_tax()) {
$desc = term_description();
}
// Now match other possibilities...
if (is_author()) {
$desc = get_the_author_meta('description');
}
// Front or home page
if (is_front_page() || is_home()) {
$desc = get_bloginfo('description');
}
// No excerpt to return
if (is_404() || is_search()) {
$desc = '';
}
$desc = ubik_seo_meta_description_sanitize($desc);
}
return apply_filters('ubik_seo_meta_description', $desc);
}
示例13: teo_filter_wp_title
function teo_filter_wp_title($old_title, $sep, $sep_location)
{
$ssep = ' ' . $sep . ' ';
if (is_home()) {
return get_bloginfo('name');
} elseif (is_single() || is_page()) {
return get_the_title();
} elseif (is_category()) {
$output = $ssep . 'Category';
} elseif (is_tag()) {
$output = $ssep . 'Tag';
} elseif (is_author()) {
$output = $ssep . 'Author';
} elseif (is_year() || is_month() || is_day()) {
$output = $ssep . 'Archives';
} else {
$output = NULL;
}
// get the page number we're on (index)
if (get_query_var('paged')) {
$num = $ssep . 'page ' . get_query_var('paged');
} elseif (get_query_var('page')) {
$num = $ssep . 'page ' . get_query_var('page');
} else {
$num = NULL;
}
// concoct and return new title
return get_bloginfo('name') . $output . $old_title . $num;
}
示例14: ya_title
/**
* Page titles
*/
function ya_title()
{
if (is_home()) {
if (get_option('page_for_posts', true)) {
echo get_the_title(get_option('page_for_posts', true));
} else {
esc_html_e('Latest Posts', 'yatheme');
}
} elseif (is_archive()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if ($term) {
echo $term->name;
} elseif (is_post_type_archive()) {
echo get_queried_object()->labels->name;
} elseif (is_day()) {
printf(__('Daily Archives: %s', 'yatheme'), get_the_date());
} elseif (is_month()) {
printf(__('Monthly Archives: %s', 'yatheme'), get_the_date('F Y'));
} elseif (is_year()) {
printf(__('Yearly Archives: %s', 'yatheme'), get_the_date('Y'));
} elseif (is_author()) {
printf(__('Author Archives: %s', 'yatheme'), get_the_author());
} else {
single_cat_title();
}
} elseif (is_search()) {
printf(__('Search Results for <small>%s</small>', 'yatheme'), get_search_query());
} elseif (is_404()) {
esc_html_e('Not Found', 'yatheme');
} else {
the_title();
}
}
示例15: hwseo_get_current_user
function hwseo_get_current_user()
{
global $wp_query;
if (is_author()) {
return $wp_query->get_queried_object();
}
}