当前位置: 首页>>代码示例>>PHP>>正文


PHP ap_get_theme_location函数代码示例

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


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

示例1: widget

 public function widget($args, $instance)
 {
     global $questions;
     $title = apply_filters('widget_title', $instance['title']);
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     echo '<div class="ap-widget-inner">';
     if (!class_exists('Tags_For_AnsPress')) {
         echo 'Tags plugin must be installed for related question. Get <a href="https://wordpress.org/plugins/tags-for-anspress">Tags for AnsPress</a>';
         return;
     }
     $tags = get_the_terms(get_question_id(), 'question_tag');
     $tags_in = array();
     if ($tags) {
         foreach ($tags as $t) {
             $tags_in[] = $t->term_id;
         }
     }
     $question_args = array('tax_query' => array(array('taxonomy' => 'question_tag', 'field' => 'term_id', 'terms' => $tags_in)), 'showposts' => 5, 'post__not_in' => array(get_question_id()));
     $questions = ap_get_questions($question_args);
     include ap_get_theme_location('widget-related_questions.php');
     wp_reset_postdata();
     echo '</div>';
     echo $args['after_widget'];
 }
开发者ID:deepakd92,项目名称:anspress,代码行数:27,代码来源:related_questions.php

示例2: comment_template

 public function comment_template($comment_template)
 {
     global $post;
     if ($post->post_type == 'question' || $post->post_type == 'answer') {
         return ap_get_theme_location('comments.php');
     }
 }
开发者ID:jessor,项目名称:anspress,代码行数:7,代码来源:anspress-theme.php

示例3: widget

 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     $number = $instance['number'];
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     $user_a = array('number' => $number, 'ap_query' => 'sort_points', 'meta_key' => 'ap_points', 'orderby' => 'meta_value');
     // The Query
     $users = new WP_User_Query($user_a);
     include ap_get_theme_location('users-widget.php');
     echo $args['after_widget'];
 }
开发者ID:haythameyd,项目名称:powrly,代码行数:14,代码来源:users.php

示例4: widget

 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     $avatar = $instance['avatar'];
     $order = $instance['order'];
     $show_selected = $instance['show_selected'];
     $show_activity = $instance['show_activity'];
     $show_answers = $instance['show_answers'];
     $show_vote = $instance['show_vote'];
     $show_views = $instance['show_views'];
     $show_category = $instance['show_category'];
     $show_tags = $instance['show_tags'];
     $label = $instance['label'];
     $limit = $instance['limit'];
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     if (empty($label)) {
         $label = '';
     }
     $question_args = array('ap_query' => 'main_questions', 'post_type' => 'question', 'post_status' => 'publish', 'showposts' => $limit);
     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 = new WP_Query($question_args);
     include ap_get_theme_location('questions-widget.php');
     echo $args['after_widget'];
     wp_reset_postdata();
 }
开发者ID:coollog,项目名称:theboola,代码行数:49,代码来源:questions.php

示例5: ap_find_bad_words

/**
 * Find bad words in a string.
 * @param  string $str String need to be checked.
 * @return array|boolean
 * @since  2.4.5
 */
function ap_find_bad_words($str)
{
    $bad_word_file = ap_get_theme_location('badwords.txt');
    // Return if badwords.txt file does not exists.
    if (!file_exists($bad_word_file)) {
        return false;
    }
    $words = file($bad_word_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $found = array();
    foreach ($words as $w) {
        $count = preg_match_all('/\\b' . preg_quote($w, '/') . '\\b/i', $str);
        if ($count > 0) {
            $found[$w] = $count;
        }
    }
    if (!empty($found)) {
        return $found;
    }
    return false;
}
开发者ID:alaershov,项目名称:anspress,代码行数:26,代码来源:class-bad-words.php

示例6: 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

示例7: widget

 public function widget($args, $instance)
 {
     global $ap_user_query;
     $title = apply_filters('widget_title', $instance['title']);
     $number = $instance['number'];
     $sortby = $instance['sortby'];
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     $user_a = array('number' => $number, 'sortby' => $sortby);
     // The Query.
     $ap_user_query = ap_has_users($user_a);
     echo '<div class="ap-widget-inner">';
     while (ap_users()) {
         ap_the_user();
         include ap_get_theme_location('users/loop-item.php');
     }
     echo '</div>';
     echo $args['after_widget'];
 }
开发者ID:Byrlyne,项目名称:anspress,代码行数:21,代码来源:users.php

示例8: widget

 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     $avatar = $instance['avatar'];
     $show_selected = $instance['show_selected'];
     $show_activity = $instance['show_activity'];
     $show_answers = $instance['show_answers'];
     $show_vote = $instance['show_vote'];
     $show_views = $instance['show_views'];
     $show_category = $instance['show_category'];
     $show_tags = $instance['show_tags'];
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     $question_args = array('ap_query' => 'related', 'ap_title' => get_the_title(get_question_id()), 'post_type' => 'question', 'post__not_in' => array(get_question_id()), 'post_status' => 'publish', 'showposts' => ap_opt('question_per_page'));
     $question = new WP_Query($question_args);
     include ap_get_theme_location('questions-widget.php');
     echo $args['after_widget'];
     wp_reset_postdata();
 }
开发者ID:jessor,项目名称:anspress,代码行数:21,代码来源:related_questions.php

示例9: anspress_question_sc

 /**
  * Control the output of [question] shortcode
  * @param  string $content
  * @return string
  * @since 2.0.0-beta
  */
 public function anspress_question_sc($atts, $content = '')
 {
     ob_start();
     echo '<div id="anspress" class="ap-eq">';
     /**
      * ACTION: ap_before_question_shortcode
      * Action is fired before loading AnsPress body.
      */
     do_action('ap_before_question_shortcode');
     $questions = ap_get_question($atts['id']);
     if ($questions->have_posts()) {
         /**
          * Set current question as global post
          * @since 2.3.3
          */
         while ($questions->have_posts()) {
             $questions->the_post();
             include ap_get_theme_location('shortcode/question.php');
         }
     }
     echo '</div>';
     wp_reset_postdata();
     return ob_get_clean();
 }
开发者ID:Byrlyne,项目名称:anspress,代码行数:30,代码来源:shortcode-question.php

示例10: ap_comment

 function ap_comment($comment)
 {
     $GLOBALS['comment'] = $comment;
     $class = '0' == $comment->comment_approved ? ' pending' : '';
     include ap_get_theme_location('comment.php');
 }
开发者ID:Byrlyne,项目名称:anspress,代码行数:6,代码来源:functions.php

示例11: subscription_page

 public function subscription_page($active)
 {
     $active = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'question';
     if ($active != 'category') {
         return;
     }
     global $question_categories, $ap_max_num_pages, $ap_per_page;
     $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);
     $ap_max_num_pages = $total_terms / $per_page;
     $cat_args = array('user_id' => get_current_user_id(), 'ap_query' => 'subscription', 'parent' => 0, 'number' => $per_page, 'offset' => $offset, 'hide_empty' => false, 'orderby' => 'count', 'order' => 'DESC');
     $question_categories = get_terms('question_category', $cat_args);
     include ap_get_theme_location('categories.php', CATEGORIES_FOR_ANSPRESS_DIR);
 }
开发者ID:BRoz,项目名称:categories-for-anspress,代码行数:16,代码来源:categories-for-anspress.php

示例12: ap_question_the_answers

/**
 * Output answer of active question.
 * @return void
 * @since 2.1
 */
function ap_question_the_answers()
{
    global $answers;
    $answers = ap_get_best_answer();
    include ap_get_theme_location('best_answer.php');
    $answers = ap_get_answers();
    include ap_get_theme_location('answers.php');
    wp_reset_postdata();
}
开发者ID:Byrlyne,项目名称:anspress,代码行数:14,代码来源:question-loop.php

示例13: following_page

 /**
  * Register followers page in AnsPress
  */
 public function following_page()
 {
     $following = ap_has_users(array('user_id' => ap_get_displayed_user_id(), 'sortby' => 'following'));
     if ($following->has_users()) {
         include ap_get_theme_location('user/following.php');
     } else {
         esc_attr_e('You are not following anyone.', 'anspress-question-answer');
     }
 }
开发者ID:alaershov,项目名称:anspress,代码行数:12,代码来源:class-user.php

示例14: foreach

<div id="ap-following" class="ap-users-lists clearfix">
	<?php 
if (!empty($following)) {
    foreach ($following as $f) {
        $data = $f->data;
        $current_user_meta = array_map(function ($a) {
            return $a[0];
        }, get_user_meta($f->ID));
        include ap_get_theme_location('content-user.php');
    }
} else {
    _e('No users found.', 'ap');
}
?>
</div>

<?php 
if (!empty($following)) {
    ap_pagi($base, $total_pages, $paged);
}
开发者ID:coollog,项目名称:theboola,代码行数:20,代码来源:user-following.php

示例15: subscription_page

 public function subscription_page($active)
 {
     $active = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'question';
     if ($active != 'tag') {
         return;
     }
     global $question_tags, $ap_max_num_pages, $ap_per_page, $tags_rows_found;
     $paged = get_query_var('paged') ? get_query_var('paged') : 1;
     $per_page = ap_opt('tags_per_page');
     $total_terms = $tags_rows_found;
     $offset = $per_page * ($paged - 1);
     $ap_max_num_pages = ceil($total_terms / $per_page);
     $tag_args = array('ap_tags_query' => 'num_rows', 'ap_query' => 'tags_subscription', 'parent' => 0, 'number' => $per_page, 'offset' => $offset, 'hide_empty' => false, 'order' => 'DESC', 'user_id' => get_current_user_id());
     if (@$_GET['ap_sort'] == 'new') {
         $tag_args['orderby'] = 'id';
         $tag_args['order'] = 'ASC';
     } elseif (@$_GET['ap_sort'] == 'name') {
         $tag_args['orderby'] = 'name';
         $tag_args['order'] = 'ASC';
     } else {
         $tag_args['orderby'] = 'count';
     }
     if (isset($_GET['ap_s'])) {
         $tag_args['search'] = sanitize_text_field($_GET['ap_s']);
     }
     $question_tags = get_terms('question_tag', $tag_args);
     include ap_get_theme_location('tags.php', TAGS_FOR_ANSPRESS_DIR);
 }
开发者ID:venturepact,项目名称:blog,代码行数:28,代码来源:tags-for-anspress.php


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