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

PHP get_question_id函数代码示例

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

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



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


示例16: _e

					<?php 
    if (ap_opt('answer_help_page') != '') {
        ?>
						<li><a href="#ap-form-help"><?php 
        _e('How to answer', 'ap');
        ?>
</a></li>
					<?php 
    }
    ?>
				</ul>				
			</div>
			<div class="ap-tab-container">
				<div id="ap-form-main" class="active ap-tab-item">
					<?php 
    ap_answer_form(get_question_id());
    ?>
				</div>
				<div id="ap-form-help" class="ap-tab-item">
					<?php 
    if (ap_opt('answer_help_page') != '') {
        ?>
						
						<?php 
        ap_how_to_answer();
        ?>
					<?php 
    }
    ?>
				</div>
			</div>
开发者ID:BRoz,项目名称:anspress,代码行数:31,代码来源:answer-form.php


示例17: ap_get_breadcrumbs

function ap_get_breadcrumbs()
{
    $current_page = get_query_var('ap_page');
    $title = ap_page_title();
    $a = array();
    $a['base'] = array('title' => ap_opt('base_page_title'), 'link' => ap_base_page_link(), 'order' => 0);
    if (is_question_tag()) {
        $a['tag'] = array('title' => __('Tags', 'ap'), 'link' => '', 'order' => 10);
    } elseif (is_question()) {
        $a['page'] = array('title' => substr($title, 0, 30) . (strlen($title) > 30 ? __('..', 'ap') : ''), 'link' => get_permalink(get_question_id()), 'order' => 10);
    } elseif ($current_page != 'base' && $current_page != '') {
        if ($current_page == 'user') {
            $a['page'] = array('title' => __('User', 'ap'), 'link' => ap_user_link(ap_get_displayed_user_id()), 'order' => 10);
            $a['user_page'] = array('title' => substr($title, 0, 30) . (strlen($title) > 30 ? __('..', 'ap') : ''), 'link' => ap_user_link(ap_get_displayed_user_id(), get_query_var('user_page')), 'order' => 10);
        } else {
            $a['page'] = array('title' => substr($title, 0, 30) . (strlen($title) > 30 ? __('..', 'ap') : ''), 'link' => ap_get_link_to($current_page), 'order' => 10);
        }
    }
    $a = apply_filters('ap_breadcrumbs', $a);
    return ap_sort_array_by_order($a);
}
开发者ID:haythameyd,项目名称:powrly,代码行数:21,代码来源:theme.php


示例18: receive_new_question

/**
 * Ota uusi kysymys tietokantaan
 */
function receive_new_question()
{
    /* $question_id integer
     * $title string
     * $body string
     * $tags string
     */
    $body = pg_escape_string($_POST['question']['body']);
    $title = pg_escape_string($_POST['question']['title']);
    $tags = $_POST['question']['tags'];
    /** 
     * Tarkasta sisaankirjaus
     */
    if (check_user_status()) {
        echo "User status pelaa";
        if (validate_input($title, $body, $tags)) {
            echo "User input pelaa";
            $title = $_POST['question']['title'];
            set_question();
            set_tags();
            $question_id = get_question_id();
            // question must be set before
            header("Location: /pgCodesS/index.php?" . "question_sent" . "&" . "question_id=" . $question_id . "&" . $title);
        } else {
            header("Location: /pgCodesS/index.php?" . "ask_question" . "&unsuccessful_new_question");
        }
    } else {
        header("Location: /pgCodesS/index.php" . "ask_question" . "&unsuccessful_new_question");
    }
}
开发者ID:vilsu,项目名称:codes,代码行数:33,代码来源:receive_new_question.php


示例19: question_page

 /**
  * Output single question page
  * @return void
  */
 public function question_page()
 {
     // Set Header as 404 if question id is not set.
     if (false === get_question_id()) {
         $this->set_404();
         return;
     }
     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 {
         $this->set_404();
     }
 }
开发者ID:Byrlyne,项目名称:anspress,代码行数:29,代码来源:common-pages.php


示例20: ap_question_subscribers

function ap_question_subscribers($action_id = false, $type = '', $avatar_size = 30)
{
    global $question_category, $question_tag;
    if (false === $action_id) {
        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 == '') {
        $type = is_question() ? 'q_all' : 'tax_new_q';
    }
    $subscribers = ap_get_subscribers($action_id, $type);
    if ($subscribers) {
        echo '<div class="ap-question-subscribers clearfix">';
        echo '<div class="ap-question-subscribers-inner">';
        foreach ($subscribers as $subscriber) {
            echo '<a href="' . ap_user_link($subscriber->subs_user_id) . '"';
            ap_hover_card_attributes($subscriber->subs_user_id);
            echo '>' . get_avatar($subscriber->subs_user_id, $avatar_size) . '</a>';
        }
        echo '</div>';
        echo '</div>';
    }
}
开发者ID:nextgenthemes,项目名称:anspress,代码行数:28,代码来源:subscriber.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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