예제 #1
0
/**
 * Print class for question detail container
 */
function dwqa_breadcrumb()
{
    global $dwqa_general_settings;
    $title = get_the_title($dwqa_general_settings['pages']['archive-question']);
    $search = isset($_GET['qs']) ? $_GET['qs'] : false;
    $author = isset($_GET['user']) ? $_GET['user'] : false;
    if (!is_singular('dwqa-question')) {
        $term = get_query_var('dwqa-question_category') ? get_query_var('dwqa-question_category') : (get_query_var('dwqa-question_tag') ? get_query_var('dwqa-question_tag') : false);
        $term = get_term_by('slug', $term, get_query_var('taxonomy'));
        $tax_name = 'dwqa-question_tag' == get_query_var('taxonomy') ? __('Tag', 'dwqa') : __('Category', 'dwqa');
    } else {
        $term = wp_get_post_terms(get_the_ID(), 'dwqa-question_category');
        if ($term) {
            $term = $term[0];
            $tax_name = __('Category', 'dwqa');
        }
    }
    if (is_singular('dwqa-question') || $search || $author || $term) {
        echo '<div class="dwqa-breadcrumbs">';
    }
    if ($term || is_singular('dwqa-question') || $search || $author) {
        echo '<a href="' . get_permalink($dwqa_general_settings['pages']['archive-question']) . '">' . $title . '</a>';
    }
    if ($term) {
        echo '<span class="dwqa-sep"> &rsaquo; </span>';
        if (is_singular('dwqa-question')) {
            echo '<a href="' . esc_url(get_term_link($term, get_query_var('taxonomy'))) . '">' . $tax_name . ': ' . $term->name . '</a>';
        } else {
            echo '<span class="dwqa-current">' . $tax_name . ': ' . $term->name . '</span>';
        }
    }
    if ($search) {
        echo '<span class="dwqa-sep"> &rsaquo; </span>';
        printf('<span class="dwqa-current">%s "%s"</span>', __('Showing search results for', 'dwqa'), rawurldecode($search));
    }
    if ($author) {
        echo '<span class="dwqa-sep"> &rsaquo; </span>';
        printf('<span class="dwqa-current">%s "%s"</span>', __('Author', 'dwqa'), rawurldecode($author));
    }
    if (is_singular('dwqa-question')) {
        echo '<span class="dwqa-sep"> &rsaquo; </span>';
        if (!dwqa_is_edit()) {
            echo '<span class="dwqa-current">' . get_the_title() . '</span>';
        } else {
            echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
            echo '<span class="dwqa-sep"> &rsaquo; </span>';
            echo '<span class="dwqa-current">' . __('Edit', 'dwqa') . '</span>';
        }
    }
    if (is_singular('dwqa-question') || $search || $author || $term) {
        echo '</div>';
    }
}
 */
// global $wp_query; print_r( $wp_query );
?>
<div class="dwqa-single-question">
<?php 
if (have_posts()) {
    ?>
	<?php 
    do_action('dwqa_before_single_question');
    ?>
	<?php 
    while (have_posts()) {
        the_post();
        ?>
		<?php 
        if (!dwqa_is_edit()) {
            ?>
			<?php 
            dwqa_load_template('content', 'single-question');
            ?>
		<?php 
        } else {
            ?>
			<?php 
            dwqa_load_template('content', 'edit');
            ?>
		<?php 
        }
        ?>
	<?php 
    }