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


PHP get_question_id函数代码示例

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


在下文中一共展示了get_question_id函数的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: __construct

 /**
  * Initialize class
  * @param array $args Query arguments.
  * @access public
  * @since  2.0
  */
 public function __construct($args = array())
 {
     global $answers;
     $paged = get_query_var('paged') ? get_query_var('paged') : 1;
     $defaults = array('question_id' => get_question_id(), 'ap_answers_query' => true, 'showposts' => ap_opt('answers_per_page'), 'paged' => $paged, 'only_best_answer' => false, 'include_best_answer' => false);
     $args['post_status'][] = 'publish';
     $args['post_status'][] = 'closed';
     $this->args = wp_parse_args($args, $defaults);
     if (isset($this->args['question_id'])) {
         $question_id = $this->args['question_id'];
     }
     if (!empty($question_id)) {
         $this->args['post_parent'] = $question_id;
     }
     if (isset($this->args['sortby'])) {
         $this->orderby_answers();
     }
     // Check if requesting only for best Answer
     if (isset($this->args['only_best_answer']) && $this->args['only_best_answer']) {
         $this->args['meta_query'] = array(array('key' => ANSPRESS_BEST_META, 'type' => 'BOOLEAN', 'compare' => '=', 'value' => '1'));
     }
     $this->args['post_type'] = 'answer';
     $args = $this->args;
     /**
      * Initialize parent class
      */
     parent::__construct($args);
 }
开发者ID:troe,项目名称:anspress,代码行数:34,代码来源:answer-loop.php

示例3: wp_head

 public function wp_head()
 {
     if (is_question()) {
         global $wp;
         echo '<link href="' . home_url(add_query_arg(array(), $wp->request)) . '" title="' . wp_title('|', false, 'right') . '" type="application/rss+xml" rel="alternate">';
         echo '<link rel="canonical" href="' . get_permalink(get_question_id()) . '"> ';
     }
 }
开发者ID:coollog,项目名称:theboola,代码行数:8,代码来源:anspress-main.php

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

示例5: ap_get_all_parti

/**
 * Print all particpants of a question
 * @param  integer $avatar_size
 * @param  boolean $post_id
 * @return void
 * @since  0.4
 */
function ap_get_all_parti($avatar_size = 40, $post_id = false)
{
    if (!$post_id) {
        $post_id = get_question_id();
    }
    $parti = ap_get_parti($post_id);
    echo '<span class="ap-widget-title">' . sprintf(_n('<span>1</span> Participant', '<span>%d</span> Participants', count($parti), 'ap'), count($parti)) . '</span>';
    echo '<div class="ap-participants-list clearfix">';
    foreach ($parti as $p) {
        echo '<a title="' . ap_user_display_name($p->apmeta_userid, true) . '" href="' . ap_user_link($p->apmeta_userid) . '" class="ap-avatar">';
        echo get_avatar($p->apmeta_userid, $avatar_size);
        echo '</a>';
    }
    echo '</div>';
}
开发者ID:Byrlyne,项目名称:anspress,代码行数:22,代码来源:participants.php

示例6: question_page

 /**
  * Output single question page
  * @return void
  */
 public function question_page()
 {
     global $questions;
     ap_get_question(get_question_id());
     if (ap_have_questions()) {
         while (anspress()->questions->have_posts()) {
             anspress()->questions->the_post();
             global $post;
             setup_postdata($post);
         }
         include ap_get_theme_location('question.php');
         wp_reset_postdata();
     } else {
         include ap_get_theme_location('not-found.php');
     }
 }
开发者ID:haythameyd,项目名称:powrly,代码行数:20,代码来源:common-pages.php

示例7: question_page

 /**
  * Output single question page
  * @return void
  */
 public function question_page()
 {
     global $questions;
     $questions = ap_get_question(get_question_id());
     if (ap_have_questions()) {
         /**
          * Set current question as global post
          * @since 2.3.3
          */
         while (ap_questions()) {
             ap_the_question();
             global $post;
             setup_postdata($post);
             include ap_get_theme_location('question.php');
         }
         wp_reset_postdata();
     } else {
         include ap_get_theme_location('not-found.php');
     }
 }
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:24,代码来源:common-pages.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: _e

							<li class="ap-tip ap-ansslable" title="<?php 
    _e('Answer is accepted', 'ap');
    ?>
">
								<i class="ap-icon-answer"></i>
							</li>
						<?php 
}
?>
						<li class="list-meta ap-tip" title="<?php 
_e('Last activity', 'ap');
?>
">	
							<i class="ap-icon-clock ap-meta-icon"></i>
							<?php 
printf('<span class="when">%s %s ago</span>', ap_get_latest_history_html(get_the_ID()), ap_human_time(mysql2date('U', ap_last_active(get_question_id()))));
ap_user_display_name();
?>
						</li>
						<li class="ap-tip" title="<?php 
_e('Question category', 'ap');
?>
"><?php 
ap_question_categories_html(false, false);
?>
</li>
						<li class="ap-tip" title="<?php 
_e('Question tagged', 'ap');
?>
"><?php 
ap_question_tags_html(false, false);
开发者ID:jessor,项目名称:anspress,代码行数:31,代码来源:content-list.php

示例10: ap_post_subscribers_count

function ap_post_subscribers_count($post_id)
{
    _deprecated_function('ap_post_subscribers_count', '2.2.0.1', 'ap_subscribers_count');
    $post_id = $post_id ? $post_id : get_question_id();
    return ap_meta_total_count('subscriber', $post_id);
}
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:6,代码来源:deprecated.php

示例11: _e

				<div class="ap-question-side">
					<h3 class="ap-question-side-title"><?php 
            _e('Tags', 'ap');
            ?>
</h3>
					<?php 
            ap_question_tags_html(get_question_id());
            ?>
				</div>
				<?php 
        }
        ?>
				<!-- End Tags -->
				
				<!-- Start participants -->
				<div class="ap-question-side">			
					<?php 
        ap_get_all_parti(30, get_question_id());
        ?>
				</div>
				<!-- End participants -->
			</div>
		</div>
	</div>
</div>

<?php 
    } else {
        echo '<div class="ap-pending-notice ap-icon-clock">' . __('You do not have permission to view this question.') . '</div>';
    }
}
开发者ID:coollog,项目名称:theboola,代码行数:31,代码来源:question.php

示例12: get_question_id

<?php

$question_id = get_question_id();
$current_user = get_userdata(get_current_user_id());
$validate = ap_validate_form();
if (!empty($validate['has_error'])) {
    echo '<div class="alert alert-danger" data-dismiss="alert"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>' . __('Problem submitting form, please recheck form', 'ap') . '</div>';
}
?>

<div id="answer-form-c">	
	<div class="ap-avatar">
		<?php 
echo get_avatar($current_user->user_email, ap_opt('avatar_size_qquestion'));
?>
	</div>
	<?php 
ap_answer_form($question_id);
?>
</div>
开发者ID:coollog,项目名称:theboola,代码行数:20,代码来源:answer-form.php

示例13: ap_subscribe_btn_html

/**
 * Output subscribe btn HTML
 * @param boolean|integer $action_id Question ID or Term ID
 * @return string
 * @since 2.0.1
 */
function ap_subscribe_btn_html($action_id = false, $type = false)
{
    global $question_category, $question_tag;
    if ($action_id === false) {
        if (is_question()) {
            $action_id = get_question_id();
        } elseif (is_question_category()) {
            $action_id = $question_category->term_id;
        } elseif (is_question_tag()) {
            $action_id = $question_tag->term_id;
        }
    }
    if ($type == false) {
        if (is_question_category()) {
            $subscribe_type = 'category';
        } elseif (is_question_tag()) {
            $subscribe_type = 'tag';
        } else {
            $subscribe_type = false;
        }
    } else {
        if ($type === 'category') {
            $subscribe_type = 'category';
        } elseif ($type === 'tag') {
            $subscribe_type = 'tag';
        } else {
            $subscribe_type = false;
        }
    }
    $subscribed = ap_is_user_subscribed($action_id, false, $subscribe_type);
    $nonce = wp_create_nonce('subscribe_' . $action_id . '_' . $subscribe_type);
    $title = !$subscribed ? __('Follow question', 'ap') : __('Unfollow question', 'ap');
    ?>

	<div class="ap-subscribe" id="<?php 
    echo 'subscribe_' . $action_id;
    ?>
">
		<a href="#" class="ap-btn-toggle<?php 
    echo $subscribed ? ' active' : '';
    ?>
" data-query="ap_ajax_action=subscribe&action_id=<?php 
    echo $action_id;
    ?>
&__nonce=<?php 
    echo $nonce;
    ?>
&type=<?php 
    echo $subscribe_type;
    ?>
" data-action="ap_subscribe" data-args="<?php 
    echo $action_id . '-' . $nonce;
    ?>
">
			<span class="apicon-toggle-on"></span>
			<span class="apicon-toggle-off"></span>
		</a>
		<b><?php 
    echo $title;
    ?>
</b>
	</div>

	<?php 
}
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:71,代码来源:subscriber.php

示例14: direct_right

/**
 * Ohjaa kayttaja halutulle sivulle
 */
function direct_right()
{
    if (array_key_exists('question_id', $_GET)) {
        // To redirect the user back to the question where he logged in
        $question_id = get_question_id();
        header("Location: /pgCodesS/index.php?question_id=" . $question_id . "&successful_login");
    } else {
        if ($_GET['login']) {
            header("Location: /pgCodesS/index.php?" . "successful_login");
        } else {
            header("Location: /pgCodesS/index.php");
        }
    }
}
开发者ID:vilsu,项目名称:codes,代码行数:17,代码来源:receive_registration_form.php

示例15: wpseo_canonical

 /**
  * Update concal link when wpseo plugin installed
  * @return string
  */
 public function wpseo_canonical()
 {
     if (is_question()) {
         return get_permalink(get_question_id());
     }
 }
开发者ID:Byrlyne,项目名称:anspress,代码行数:10,代码来源:class-theme.php


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