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


PHP dwqa_load_template函数代码示例

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


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

示例1: submit_question_form_shortcode

 public function submit_question_form_shortcode()
 {
     global $dwqa, $dwqa_sript_vars, $script_version;
     ob_start();
     $dwqa->template->remove_all_filters('the_content');
     echo '<div class="dwqa-container" >';
     dwqa_load_template('question', 'submit-form');
     echo '</div>';
     $html = ob_get_contents();
     $dwqa->template->restore_all_filters('the_content');
     ob_end_clean();
     wp_enqueue_script('dwqa-submit-question', DWQA_URI . 'inc/templates/default/assets/js/dwqa-submit-question.js', array('jquery'), $script_version, true);
     wp_localize_script('dwqa-submit-question', 'dwqa', $dwqa_sript_vars);
     return $this->sanitize_output($html);
 }
开发者ID:blogfor,项目名称:king,代码行数:15,代码来源:Shortcode.php

示例2: submit_question_form_shortcode

 public function submit_question_form_shortcode()
 {
     global $dwqa_sript_vars, $script_version, $dwqa_template_compat;
     ob_start();
     $dwqa_template_compat->remove_all_filters('the_content');
     echo '<div class="dwqa-container" >';
     if (dwqa_current_user_can('post_question')) {
         dwqa_load_template('question', 'submit-form');
     } else {
         echo '<p class="alert alert-error">' . __('You do not have permission to submit question.', 'dwqa') . '</p>';
     }
     echo '</div>';
     $html = ob_get_contents();
     $dwqa_template_compat->restore_all_filters('the_content');
     ob_end_clean();
     wp_enqueue_script('dwqa-submit-question', DWQA_URI . 'inc/templates/default/assets/js/dwqa-submit-question.js', array('jquery'), $script_version, true);
     wp_localize_script('dwqa-submit-question', 'dwqa', $dwqa_sript_vars);
     return $this->sanitize_output($html);
 }
开发者ID:douglaswebdesigns,项目名称:ask-bio-expert,代码行数:19,代码来源:shortcodes.php

示例3: dwqa_submit_question_form

function dwqa_submit_question_form()
{
    _deprecated_function(__FUNCTION__, '1.2.6', 'dwqa_load_template( "submit-question", "form" )');
    dwqa_load_template('submit-question', 'form');
}
开发者ID:blogfor,项目名称:king,代码行数:5,代码来源:deprecated.php

示例4: do_action

</div>
					<?php 
        }
        ?>
  <!-- Question Tags -->

					<?php 
        do_action('dwqa-question-content-footer');
        ?>
					
					<!-- Question footer -->
					<div class="dwqa-comments">
						<?php 
        comments_template();
        ?>
					</div>
				</div><!-- end question -->

				<div id="dwqa-answers">
					<?php 
        dwqa_load_template('answers');
        ?>
				</div><!-- end dwqa-add-answers -->
			</div><!-- end dwqa-single-question -->
		<?php 
    }
    // end of the loop.
    ?>
  
	<?php 
}
开发者ID:douglaswebdesigns,项目名称:ask-bio-expert,代码行数:31,代码来源:single-question.php

示例5: filter_question

 /**
  * AJAX: To make filter questions for plugins
  * @return string JSON
  */
 public function filter_question()
 {
     if (!isset($_POST['nonce'])) {
         wp_die(0);
     }
     if (!check_ajax_referer('_dwqa_filter_nonce', 'nonce', false)) {
         wp_die(0);
     }
     if (!isset($_POST['type'])) {
         wp_die(0);
     }
     // Make an query for
     global $wpdb;
     if (!defined('DWQA_FILTERING')) {
         define('DWQA_FILTERING', true);
     }
     $this->filter = wp_parse_args($_POST, $this->filter);
     //query post filter
     add_filter('posts_join', array($this, 'join_postmeta_count_answers'));
     add_filter('posts_orderby', array($this, 'edit_posts_orderby'));
     add_filter('posts_where', array($this, 'posts_where'));
     $questions = $this->get_questions();
     //remove query post filter
     remove_filter('posts_join', array($this, 'join_postmeta_count_answers'));
     remove_filter('posts_orderby', array($this, 'edit_posts_orderby'));
     remove_filter('posts_where', array($this, 'posts_where'));
     // Print content of questions
     if ($questions->have_posts()) {
         global $post;
         $pages_total = $questions->found_posts;
         $pages_number = ceil($pages_total / (int) $this->filter['posts_per_page']);
         $start_page = isset($this->filter['paged']) && $this->filter['paged'] > 2 ? $this->filter['paged'] - 2 : 1;
         if ($pages_number > 1) {
             $link = get_post_type_archive_link('dwqa-question');
             ob_start();
             echo '<ul data-pages="' . $pages_number . '" >';
             echo '<li class="prev' . ($this->filter['paged'] == 1 ? ' dwqa-hide' : '') . '"><a href="javascript:void( 0 );">Prev</a></li>';
             if ($start_page > 1) {
                 echo '<li><a href="' . esc_url(add_query_arg('paged', 1, $link)) . '">1</a></li><li class="dot"><span>...</span></li>';
             }
             for ($i = $start_page; $i < $start_page + 5; $i++) {
                 if ($pages_number < $i) {
                     break;
                 }
                 if ($i == $this->filter['paged']) {
                     echo '<li class="active"><a href="' . $link . '">' . $i . '</a></li>';
                 } else {
                     echo '<li><a href="' . esc_url(add_query_arg('paged', $i, $link)) . '">' . $i . '</a></li>';
                 }
             }
             if ($i - 1 < $pages_number) {
                 echo '<li class="dot"><span>...</span></li><li><a href="' . esc_url(add_query_arg('paged', $pages_number, $link)) . '"> ' . $pages_number . '</a></li>';
             }
             echo '<li class="next' . ($this->filter['paged'] == $pages_number ? ' dwqa-hide' : '') . '"><a href="javascript:void( 0 );">' . __('Next', 'dwqa') . '</a></li>';
             echo '</ul>';
             $pagenavigation = ob_get_contents();
             ob_end_clean();
         }
         ob_start();
         while ($questions->have_posts()) {
             $questions->the_post();
             dwqa_load_template('content', 'question');
         }
         $results = ob_get_contents();
         ob_end_clean();
     } else {
         // Notthing found
         ob_start();
         if (!dwqa_current_user_can('read_question')) {
             echo '<div class="alert">' . __('You do not have permission to view questions', 'dwqa') . '</div>';
         }
         echo '<p class="not-found">';
         _e('Sorry, but nothing matched your filter. ', 'dwqa');
         if (is_user_logged_in()) {
             global $dwqa_options;
             if (isset($dwqa_options['pages']['submit-question'])) {
                 $submit_link = get_permalink($dwqa_options['pages']['submit-question']);
                 if ($submit_link) {
                     printf('%s <a href="%s">%s</a>', __('You can ask question', 'dwqa'), $submit_link, __('here', 'dwqa'));
                 }
             }
         } else {
             printf('%s <a href="%s">%s</a>', __('Please', 'dwqa'), wp_login_url(get_post_type_archive_link('dwqa-question')), __('Login', 'dwqa'));
             $register_link = wp_register('', '', false);
             if (!empty($register_link) && $register_link) {
                 echo __(' or', 'dwqa') . ' ' . $register_link;
             }
             _e(' to submit question.', 'dwqa');
         }
         echo '</p>';
         $results = ob_get_contents();
         ob_end_clean();
     }
     wp_send_json_success(array('results' => $results, 'pagenavi' => isset($pagenavigation) ? $pagenavigation : ''));
     wp_die();
 }
开发者ID:layoutzweb,项目名称:dw-question-answer,代码行数:100,代码来源:Filter.php

示例6: dwqa_content_end_wrapper

function dwqa_content_end_wrapper()
{
    echo '</div>';
    dwqa_load_template('content', 'end-wrapper');
    wp_reset_query();
}
开发者ID:douglaswebdesigns,项目名称:ask-bio-expert,代码行数:6,代码来源:dw-question-answer.php

示例7: question_content

 public function question_content($template)
 {
     global $dwqa_options;
     $template_folder = trailingslashit(get_template_directory());
     if (is_singular('dwqa-question')) {
         ob_start();
         remove_filter('comments_open', array($this, 'close_default_comment'));
         echo '<div class="dwqa-container" >';
         dwqa_load_template('single', 'question');
         echo '</div>';
         $content = ob_get_contents();
         add_filter('comments_open', array($this, 'close_default_comment'));
         ob_end_clean();
         // Reset post
         global $post, $current_user;
         $this->reset_content(array('ID' => $post->ID, 'post_title' => $post->post_title, 'post_author' => 0, 'post_date' => $post->post_date, 'post_content' => $content, 'post_type' => 'dwqa-question', 'post_status' => $post->post_status, 'is_single' => true));
         $single_template = isset($dwqa_options['single-template']) ? $dwqa_options['single-template'] : false;
         $this->remove_all_filters('the_content');
         if ($single_template && file_exists($template_folder . $single_template)) {
             return $template_folder . $single_template;
         } else {
             return dwqa_get_template('single.php');
         }
     }
     if (is_tax('dwqa-question_category') || is_tax('dwqa-question_tag') || is_post_type_archive('dwqa-question') || is_post_type_archive('dwqa-answer')) {
         ob_start();
         echo '<div class="dwqa-container" >';
         dwqa_load_template('question', 'list');
         echo '</div>';
         $content = ob_get_contents();
         ob_end_clean();
         $post_id = isset($dwqa_options['pages']['archive-question']) ? $dwqa_options['pages']['archive-question'] : 0;
         if ($post_id) {
             $post = get_post($post_id);
             $this->reset_content(array('ID' => $post_id, 'post_title' => $post->post_title, 'post_author' => 0, 'post_date' => $post->post_date, 'post_content' => $content, 'post_type' => 'dwqa-question', 'post_status' => $post->post_status, 'is_archive' => true, 'comment_status' => 'closed'));
             $this->remove_all_filters('the_content');
             return dwqa_get_template('page.php');
         }
     }
     return $template;
 }
开发者ID:anupomdebnath,项目名称:dw-question-answer,代码行数:41,代码来源:template-functions.php

示例8: get_header

<?php

/**
 *  Template use for display list of question 
 *
 *  @since  DW Question Answer 1.0
 */
get_header('dwqa');
?>

<?php 
do_action('dwqa_before_page');
?>

<?php 
dwqa_load_template('question', 'list');
?>

<?php 
do_action('dwqa_after_page');
?>

<?php 
get_footer('dwqa');
开发者ID:blogfor,项目名称:king,代码行数:24,代码来源:archive-question.php

示例9: dwqa_archive_question


//.........这里部分代码省略.........
</span> <i class="fa fa-sort <?php 
        echo isset($_GET['orderby']) && $_GET['orderby'] == 'votes' ? 'fa-sort-up' : '';
        ?>
"></i>
                                </li>
                            </ul>
                            <?php 
        global $dwqa_general_settings;
        $posts_per_page = isset($dwqa_general_settings['posts-per-page']) ? $dwqa_general_settings['posts-per-page'] : get_query_var('posts_per_page');
        ?>
                            <input type="hidden" id="dwqa_filter_posts_per_page" name="posts_per_page" value="<?php 
        echo $posts_per_page;
        ?>
">
                        </div>
                    </div>
                    
                    <?php 
        do_action('dwqa-before-question-list');
        ?>

                    <?php 
        do_action('dwqa-prepare-archive-posts');
        ?>
                    <?php 
        if (have_posts()) {
            ?>
                    <div class="questions-list">
                    <?php 
            while (have_posts()) {
                the_post();
                ?>
                        <?php 
                dwqa_load_template('content', 'question');
                ?>
                    <?php 
            }
            ?>
                    </div>
                    <div class="archive-question-footer">
                    <?php 
            if ($taxonomy == 'dwqa-question_category') {
                $args = array('post_type' => 'dwqa-question', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $term_name)));
                $query = new WP_Query($args);
                $total = $query->post_count;
            } else {
                if ('dwqa-question_tag' == $taxonomy) {
                    $args = array('post_type' => 'dwqa-question', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $term_name)));
                    $query = new WP_Query($args);
                    $total = $query->post_count;
                } else {
                    $total = wp_count_posts('dwqa-question');
                    $total = $total->publish;
                }
            }
            $number_questions = $total;
            $number = get_query_var('posts_per_page');
            $pages = ceil($number_questions / $number);
            if ($pages > 1) {
                ?>
                        <div class="pagination">
                            <ul data-pages="<?php 
                echo $pages;
                ?>
" >
                                <?php 
开发者ID:christianlee13,项目名称:dw-question-answer,代码行数:67,代码来源:shortcodes.php

示例10: get_permalink

if ($answers->max_num_pages > 1) {
    $question_url = get_permalink($question_id);
    echo '<h3 class="dwqa-answers-page-navigation-head">' . sprintf(__('Answer page %d', 'dwqa'), $ans_cur_page) . '</h3>';
    echo '<ul class="dwqa-answers-page-navigation">';
    for ($i = 1; $i <= $answers->max_num_pages; $i++) {
        echo '<li class="' . ($ans_cur_page == $i ? 'active' : '') . '"><a href="' . esc_url(add_query_arg('ans-page', $i, $question_url)) . '">' . $i . '</a></li>';
    }
    echo '</ul>';
}
//Create answer form
if (dwqa_is_closed($question_id)) {
    echo '<p class="alert">' . __('This question is now closed', 'dwqa') . '</p>';
    return false;
}
if (dwqa_current_user_can('post_answer')) {
    dwqa_load_template('answer', 'submit-form');
} else {
    ?>
	<?php 
    if (is_user_logged_in()) {
        ?>
		<div class="alert"><?php 
        _e('You do not have permission to submit answer.', 'dwqa');
        ?>
</div>
	<?php 
    } else {
        ?>
	<h3 class="dwqa-title">
		<?php 
        printf('%1$s <a href="%2$s" title="%3$s">%3$s</a> %4$s', __('Please login or', 'dwqa'), wp_registration_url(), __('Register', 'dwqa'), __('to Submit Answer', 'dwqa'));
开发者ID:douglaswebdesigns,项目名称:ask-bio-expert,代码行数:31,代码来源:answers.php

示例11: dwqa_display_sticky_questions

function dwqa_display_sticky_questions()
{
    $sticky_questions = get_option('dwqa_sticky_questions', array());
    if (!empty($sticky_questions)) {
        $query = array('post_type' => 'dwqa-question', 'post__in' => $sticky_questions, 'posts_per_page' => 40);
        $sticky_questions = new WP_Query($query);
        ?>
		<div class="sticky-questions">
			<?php 
        while ($sticky_questions->have_posts()) {
            $sticky_questions->the_post();
            ?>
				<?php 
            dwqa_load_template('content', 'question');
            ?>
			<?php 
        }
        ?>
		</div>
		<?php 
        wp_reset_postdata();
    }
}
开发者ID:hamdouni,项目名称:dw-question-answer,代码行数:23,代码来源:Template.php

示例12: single_question


//.........这里部分代码省略.........
            echo $meta;
            ?>
</span>
                        <?php 
            if (dwqa_current_user_can('edit_question') || dwqa_current_user_can('edit_answer') || $current_user->ID == $post->post_author) {
                ?>
                        <span class="dwqa-change-status">
                            <div class="dwqa-btn-group">
                                <button type="button" class="dropdown-toggle" ><i class="fa fa-caret-down"></i></button>
                                <div class="dwqa-dropdown-menu" data-nonce="<?php 
                echo wp_create_nonce('_dwqa_update_question_status_nonce');
                ?>
" data-question="<?php 
                the_ID();
                ?>
" >
                                    <div class="dwqa-dropdown-caret">
                                        <span class="dwqa-caret-outer"></span>
                                        <span class="dwqa-caret-inner"></span>
                                    </div>
                                    <ul role="menu" data-nonce="<?php 
                echo wp_create_nonce('_dwqa_update_question_status_nonce');
                ?>
" data-question="<?php 
                the_ID();
                ?>
">
                                        <?php 
                if ('resolved' == $meta || 'pending' == $meta || 'closed' == $meta) {
                    ?>
                                            <li class="dwqa-re-open" data-status="re-open">
                                                <a href="#"><i class="fa fa-reply"></i> <?php 
                    _e('Re-Open', 'dwqa');
                    ?>
</a>
                                            </li>
                                        <?php 
                }
                ?>
                                        <?php 
                if ('closed' != $meta) {
                    ?>
                                            <li class="dwqa-closed" data-status="closed">
                                                <a href="#"><i class="fa fa-lock"></i> <?php 
                    _e('Closed', 'dwqa');
                    ?>
</a>
                                            </li>
                                        <?php 
                }
                ?>
                                        <?php 
                if ('pending' != $meta && 'closed' != $meta && current_user_can('edit_posts', $post_id)) {
                    ?>
                                            <li class="dwqa-pending"  data-status="pending">
                                                <a href="#"><i class="fa fa-question-circle"></i> <?php 
                    _e('Pending', 'dwqa');
                    ?>
</a>
                                            </li>
                                        <?php 
                }
                ?>
                                        <?php 
                if ('resolved' != $meta && 'closed' != $meta) {
                    ?>
                                            <li class="dwqa-resolved" data-status="resolved">
                                                <a href="#"><i class="fa fa-check-circle-o"></i> <?php 
                    _e('Resolved', 'dwqa');
                    ?>
</a>
                                            </li>
                                        <?php 
                }
                ?>
                                    </ul>
                                </div>
                            </div>
                        </span>
                        <?php 
            }
            ?>
 <!-- Change Question Status -->
                    </div>
                </footer>
                <div class="dwqa-comments">
                    <?php 
            comments_template();
            ?>
                </div>
            </article><!-- end question -->

            <div id="dwqa-answers">
                <?php 
            dwqa_load_template('answers');
            ?>
            </div><!-- end dwqa-add-answers -->
        </div><!-- end dwqa-single-question -->
    <?php 
        }
开发者ID:christianlee13,项目名称:dw-question-answer,代码行数:101,代码来源:box.php

示例13: get_header

<?php

get_header('dwqa');
?>

<?php 
do_action('dwqa_before_page');
?>

    <?php 
dwqa_load_template('question', 'submit-form');
?>

<?php 
do_action('dwqa_after_page');
?>

<?php 
get_footer('dwqa');
开发者ID:blogfor,项目名称:king,代码行数:19,代码来源:question-submit.php

示例14: dwqa_load_template

        if (('private' == get_post_status() || 'pending' == get_post_status()) && (dwqa_current_user_can('edit_answer') || dwqa_current_user_can('edit_question', $question_id)) || 'publish' == get_post_status()) {
            ?>
					<?php 
            dwqa_load_template('content', 'question');
            ?>
				<?php 
        }
        ?>
			<?php 
    }
    ?>
		<?php 
} else {
    ?>
			<?php 
    dwqa_load_template('content', 'none');
    ?>
		<?php 
}
?>
		<?php 
do_action('dwqa_after_questions_list');
?>
		</div>
		<div class="dwqa-questions-footer">
			<?php 
dwqa_question_paginate_link();
?>
			<?php 
if (dwqa_current_user_can('post_question')) {
    ?>
开发者ID:layoutzweb,项目名称:dw-question-answer,代码行数:31,代码来源:archive-question.php

示例15: admin_url

echo admin_url('admin-ajax.php?action=dwqa-add-answer');
?>
" name="dwqa-answer-question-form" id="dwqa-answer-question-form" method="post">
	<?php 
add_filter('tiny_mce_before_init', 'dwqa_paste_srtip_disable');
$editor = array('wpautop' => false, 'id' => 'dwqa-answer-question-editor', 'textarea_name' => 'answer-content', 'rows' => 2);
?>
	<?php 
dwqa_init_tinymce_editor($editor);
?>
	<?php 
do_action('dwqa_submit_answer_ui', get_the_ID());
?>
	
	<?php 
dwqa_load_template('captcha', 'form');
?>
		<div class="form-buttons">
			<input type="submit" name="submit-answer" id="submit-answer" value="<?php 
_e('Add answer', 'dwqa');
?>
" class="dwqa-btn dwqa-btn-primary" />

			<?php 
if (current_user_can('edit_posts')) {
    ?>
			<input type="submit" name="submit-answer" id="save-draft-answer" value="<?php 
    _e('Save draft', 'dwqa');
    ?>
" class="dwqa-btn dwqa-btn-default" />
			<?php 
开发者ID:blogfor,项目名称:king,代码行数:31,代码来源:answer-submit-form.php


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