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

PHP is_ap_user函数代码示例

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

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



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

示例1: insert_views

 public function insert_views($template)
 {
     //Log current time as user meta, so later we can check when user was active.
     if (is_user_logged_in()) {
         update_user_meta(get_current_user_id(), '__last_active', current_time('mysql'));
     }
     if (is_question()) {
         ap_insert_views(get_question_id(), 'question');
     }
     if (is_ap_user() && ap_get_displayed_user_id() != get_current_user_id() && ap_get_displayed_user_id()) {
         ap_insert_views(ap_get_displayed_user_id(), 'profile');
     }
 }
开发者ID:kennyma603,项目名称:anspress,代码行数:13,代码来源:view.php


示例2: widget

 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     $number = $instance['number'];
     $avatar_size = $instance['avatar_size'];
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     if (is_ap_user()) {
         $followers = ap_has_users(array('user_id' => ap_get_displayed_user_id(), 'sortby' => 'followers'));
         if ($followers->has_users()) {
             include ap_get_theme_location('widgets/followers.php');
         } else {
             _e('No followers yet', 'ap');
         }
     } else {
         _e('This widget can only be used in user page.', 'ap');
     }
     echo $args['after_widget'];
 }
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:21,代码来源:followers.php


示例3: ap_page_title

 /**
  * Filter AnsPress page title for user sub pages
  * @param  string $title Title.
  * @return string
  */
 public function ap_page_title($title)
 {
     if (is_ap_user()) {
         $active = ap_active_user_page();
         $name = ap_user_get_the_display_name();
         $my = ap_is_my_profile();
         $user_pages = anspress()->user_pages;
         if ('activity' == $active) {
             $title = $my ? __('My activity', 'anspress-question-answer') : sprintf(__('%s\'s activity', 'anspress-question-answer'), $name);
         } elseif ('profile' == $active) {
             $title = $my ? __('My profile', 'anspress-question-answer') : sprintf(__('%s\'s profile', 'anspress-question-answer'), $name);
         } elseif ('questions' == $active) {
             $title = $my ? __('My questions', 'anspress-question-answer') : sprintf(__('%s\'s questions', 'anspress-question-answer'), $name);
         } elseif ('answers' == $active) {
             $title = $my ? __('My answers', 'anspress-question-answer') : sprintf(__('%s\'s answers', 'anspress-question-answer'), $name);
         } elseif ('reputation' == $active) {
             $title = $my ? __('My reputation', 'anspress-question-answer') : sprintf(__('%s\'s reputation', 'anspress-question-answer'), $name);
         } elseif ('about' == $active) {
             $title = $my ? __('About me', 'anspress-question-answer') : sprintf(__('%s', 'anspress-question-answer'), $name);
         } elseif ('followers' == $active) {
             $title = $my ? __('My followers', 'anspress-question-answer') : sprintf(__('%s\'s followers', 'anspress-question-answer'), $name);
         } elseif ('following' == $active) {
             $title = __('Following', 'anspress-question-answer');
         } elseif ('subscription' == $active) {
             $title = __('My subscriptions', 'anspress-question-answer');
         } elseif ('notification' == $active) {
             $title = __('My notification', 'anspress-question-answer');
         } else {
             $title = $user_pages[$active]['title'];
         }
     }
     return $title;
 }
开发者ID:alaershov,项目名称:anspress,代码行数:38,代码来源:class-user.php


示例4: ap_current_page_is

function ap_current_page_is()
{
    if (is_anspress()) {
        if (is_question()) {
            $template = 'question';
        } elseif (is_ask()) {
            $template = 'ask';
        } elseif (is_question_categories()) {
            $template = 'categories';
        } elseif (is_question_tags()) {
            $template = 'tags';
        } elseif (is_question_tag()) {
            $template = 'tag';
        } elseif (is_question_cat()) {
            $template = 'category';
        } elseif (is_question_edit()) {
            $template = 'edit-question';
        } elseif (is_answer_edit()) {
            $template = 'edit-answer';
        } elseif (is_ap_users()) {
            $template = 'users';
        } elseif (is_ap_user()) {
            $template = 'user';
        } elseif (is_ap_search()) {
            $template = 'search';
        } elseif (is_ap_revision()) {
            $template = 'revision';
        } elseif (get_query_var('ap_page') == '') {
            $template = 'base';
        } else {
            $template = 'not-found';
        }
        return apply_filters('ap_current_page_is', $template);
    }
    return false;
}
开发者ID:haythameyd,项目名称:powrly,代码行数:36,代码来源:theme.php


示例5: ap_get_link_to

<div class="ap-list-head clearfix">
	<form id="ap-search-form" class="ap-search-form" action="<?php 
echo ap_get_link_to('search');
?>
">
	    <input name="ap_s" type="text" class="ap-form-control" placeholder="<?php 
_e('Search questions...', 'anspress-question-answer');
?>
" value="<?php 
echo sanitize_text_field(get_query_var('ap_s'));
?>
" />
	</form>
	<?php 
// Hide ask button if user page
if (!is_ap_user()) {
    ap_ask_btn();
}
?>
	<form id="ap-question-sorting" class="ap-questions-sorting clearfix">
		<?php 
ap_question_sorting();
?>
		<?php 
do_action('ap_list_head');
?>
		<a id="ap-question-sorting-reset" href="#" title="<?php 
_e('Reset sorting and filter', 'anspress-question-answer');
?>
"><?php 
echo ap_icon('x', true);
开发者ID:deepakd92,项目名称:anspress,代码行数:31,代码来源:list-head.php


示例6: ap_base_page_sc

    public function ap_base_page_sc($atts, $content = "")
    {
        if (!is_question()) {
            $order = get_query_var('sort');
            $label = sanitize_text_field(get_query_var('label'));
            if (empty($order)) {
                $order = 'active';
            }
            //ap_opt('answers_sort');
            if (empty($label)) {
                $label = '';
            }
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
            $question_args = array('ap_query' => 'main_questions', 'post_type' => 'question', 'post_status' => 'publish', 'showposts' => ap_opt('question_per_page'), 'paged' => $paged);
            if ($order == 'active') {
                $question_args['ap_query'] = 'main_questions_active';
                $question_args['orderby'] = 'meta_value';
                $question_args['meta_key'] = ANSPRESS_UPDATED_META;
                $question_args['meta_query'] = array('relation' => 'OR', array('key' => ANSPRESS_UPDATED_META, 'compare' => 'NOT EXISTS'));
            } elseif ($order == 'voted') {
                $question_args['orderby'] = 'meta_value_num';
                $question_args['meta_key'] = ANSPRESS_VOTE_META;
            } elseif ($order == 'answers') {
                $question_args['orderby'] = 'meta_value_num';
                $question_args['meta_key'] = ANSPRESS_ANS_META;
            } elseif ($order == 'unanswered') {
                $question_args['orderby'] = 'meta_value';
                $question_args['meta_key'] = ANSPRESS_ANS_META;
                $question_args['meta_value'] = '0';
            } elseif ($order == 'oldest') {
                $question_args['orderby'] = 'date';
                $question_args['order'] = 'ASC';
            }
            if ($label != '') {
                $question_args['tax_query'] = array(array('taxonomy' => 'question_label', 'field' => 'slug', 'terms' => $label));
            }
            $question_args = apply_filters('ap_main_query_args', $question_args);
        }
        if (is_question()) {
            $args = array('p' => get_question_id(), 'post_type' => 'question', 'post_status' => array('moderate', 'publish'));
            $question = new WP_Query($args);
        } elseif (is_question_tag()) {
            $question_args['tax_query'] = array(array('taxonomy' => 'question_tags', 'field' => 'id', 'terms' => array(get_question_tag_id())));
            $question = new WP_Query($question_args);
            $tag = $question->get_queried_object();
        } elseif (is_question_cat()) {
            $question_args['tax_query'] = array(array('taxonomy' => 'question_category', 'field' => 'id', 'terms' => array(get_question_cat_id())));
            $question = new WP_Query($question_args);
            $category = $question->get_queried_object();
        } elseif (is_question_tags()) {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
            $per_page = ap_opt('tags_per_page');
            $total_terms = wp_count_terms('question_tags');
            $offset = $per_page * ($paged - 1);
            $args = array('number' => $per_page, 'offset' => $offset, 'hide_empty' => false, 'orderby' => 'count', 'order' => 'DESC');
            $tags = get_terms('question_tags', $args);
        } elseif (is_question_categories()) {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
            $per_page = ap_opt('categories_per_page');
            $total_terms = wp_count_terms('question_category');
            $offset = $per_page * ($paged - 1);
            $cat_args = array('parent' => 0, 'number' => $per_page, 'offset' => $offset, 'hide_empty' => false, 'orderby' => 'count', 'order' => 'DESC');
            $categories = get_terms('question_category', $cat_args);
        } elseif (is_ap_users()) {
            global $current_user_meta;
            $count_args = array('fields' => 'all_with_meta', 'number' => 999999);
            $user_count_query = new WP_User_Query($count_args);
            $user_count = $user_count_query->get_results();
            // count the number of users found in the query
            $total_users = $user_count ? count($user_count) : 1;
            // how many users to show per page
            $per_page = ap_opt('users_per_page');
            // grab the current page number and set to 1 if no page number is set
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
            // calculate the total number of pages.
            $total_pages = 1;
            $offset = $per_page * ($paged - 1);
            $total_pages = ceil($total_users / $per_page);
            $order = get_query_var('sort');
            if (empty($order)) {
                $order = 'points';
            }
            $args = array('number' => $per_page, 'offset' => $offset);
            if ($order == 'points') {
                $args['ap_query'] = 'sort_points';
                $args['meta_key'] = 'ap_points';
                $args['orderby'] = 'meta_value';
                $args['order'] = 'DESC';
            } elseif ($order == 'newest') {
                $args['orderby'] = 'date';
                $args['order'] = 'DESC';
            }
            // The Query
            $users = new WP_User_Query($args);
        } elseif (is_ap_user()) {
            global $current_user_meta;
            global $user;
            $user = get_userdata(ap_get_user_page_user());
            if ($user === FALSE) {
                echo '<div class="user-not-found">' . __('User not found', 'ap') . '</div>';
//.........这里部分代码省略.........
开发者ID:jessor,项目名称:anspress,代码行数:101,代码来源:anspress-shortcodes.php



注:本文中的is_ap_user函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_archive函数代码示例发布时间:2022-05-15
下一篇:
PHP is_anspress函数代码示例发布时间: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