Skip to content

Instantly share code, notes, and snippets.

Created August 23, 2013 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/28f4d8aaf60859845bca to your computer and use it in GitHub Desktop.
Save anonymous/28f4d8aaf60859845bca to your computer and use it in GitHub Desktop.
Template I'm using for archive-questions.php. I've done similar modifications for all the questions templates. The page.php is the page template my WP theme uses.
<?php get_header( 'question' );
echo theme_generator('introduce',$post_id);
1?>
<div id="page">
<div class="inner right_sidebar">
<div id="main">
<div id="qa-page-wrapper">
<div id="qa-content-wrapper">
<?php do_action( 'qa_before_content', 'archive-question' ); ?>
<?php the_qa_error_notice(); ?>
<?php the_qa_menu(); ?>
<?php if ( !have_posts() ) : ?>
<p><?php $question_ptype = get_post_type_object( 'question' ); echo $question_ptype->labels->not_found; ?></p>
<?php else: ?>
<div id="question-list">
<?php while ( have_posts() ) : the_post(); ?>
<?php do_action( 'qa_before_question_loop' ); ?>
<div class="question">
<?php do_action( 'qa_before_question' ); ?>
<div class="question-stats">
<?php do_action( 'qa_before_question_stats' ); ?>
<div class="qa-status-icon <?php echo (is_question_answered())?'qa-answered-icon':'qa-unanswered-icon'; ?>"></div>
<?php the_question_score(); ?>
<?php the_question_status(); ?>
<?php do_action( 'qa_after_question_stats' ); ?>
</div>
<div class="question-summary">
<?php do_action( 'qa_before_question_summary' ); ?>
<h3><?php the_question_link(); ?></h3>
<?php the_question_tags( '<div class="question-tags">', ' ', '</div>' ); ?>
<div class="question-started">
<?php the_qa_time( get_the_ID() ); ?>
<?php the_qa_user_link( $post->post_author ); ?>
</div>
<?php do_action( 'qa_after_question_summary' ); ?>
</div>
<?php do_action( 'qa_after_question' ); ?>
</div>
<?php do_action( 'qa_after_question_loop' ); ?>
<?php endwhile; $wp_query->set('posts_per_page', 6); ?>
</div><!--#question-list-->
<?php the_qa_pagination( ); ?>
<?php do_action( 'qa_after_content', 'archive-question' ); ?>
<?php endif;?>
</div>
</div><!--#qa-page-wrapper-->
</div><!--#main-->
<?php
global $qa_general_settings;
if ( isset( $qa_general_settings["page_layout"] ) && $qa_general_settings["page_layout"] !='content' )
get_sidebar( 'question' );
?></div> <!--.inner right_sidebar-->
<div style="clear:both;"></div>
</div><!-- #page -->
<?php get_footer( 'question' ); ?>
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*/
if(is_blog()){
return load_template(THEME_DIR . "/template_blog.php");
}elseif(is_front_page()){
return load_template(THEME_DIR . "/front-page.php");
}
$post_id = get_queried_object_id();
$layout = theme_get_inherit_option($post_id, '_layout', 'general','layout');
get_header();
echo theme_generator('introduce',$post_id);?>
<div id="page">
<div class="inner <?php if($layout=='right'):?>right_sidebar<?php endif;?><?php if($layout=='left'):?>left_sidebar<?php endif;?>">
<?php echo theme_generator('breadcrumbs',$post_id);?>
<div id="main">
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php get_template_part('content','page'); ?>
<?php endwhile; // end of the loop.?>
<div class="clearboth"></div>
</div>
<?php if($layout != 'full') get_sidebar(); ?>
<div class="clearboth"></div>
</div>
</div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment