Skip to content

Instantly share code, notes, and snippets.

@brashrebel
Forked from AutumnEyes/book-query.php
Last active August 29, 2015 14:02
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 brashrebel/08ee9e2661f12c89ec7c to your computer and use it in GitHub Desktop.
Save brashrebel/08ee9e2661f12c89ec7c to your computer and use it in GitHub Desktop.
<?php
// CUSTOM BOOK QUERY
$post_id = get_the_ID();
$args = array(
//Type & Status Parameters
'post_type' => 'accomplishment',
'post_status' => 'publish',
//Order & Orderby Parameters
'order' => 'ASC',
'orderby' => 'name',
//Pagination Parameters
'posts_per_page' => -1,
//Taxonomy Parameters
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'accomplishtype',
'field' => 'slug',
'terms' => 'book'
),
array(
'taxonomy' => 'faculty',
'field' => 'id',
'terms' => $post_id
)
)
);
$book_query = new WP_Query( $args );
if ($book_query->have_posts()) {
echo '<pre>';
print_r($book_query);
echo '</pre>';
?>
<h3>Books</h3>
<div class="row">
<ul>
<?php while ( $book_query->have_posts() ) : $book_query->the_post();
$id = get_the_id();
?>
<li>
<h3><?php the_title(); ?></h3>
<?php echo get_post_meta( $id, 'ct_Accomplish_textarea_ac19', true ); ?>
</li>
<?php endwhile; ?>
</ul>
<?php wp_reset_query(); ?>
</div>
<?php }
?>
<?php
/*
Template Name: Faculty Page
*/
/**
* Single Post Template
*
* This template is the default page template. It is used to display content when someone is viewing a
* singular view of a post ('post' post_type).
* @link http://codex.wordpress.org/Post_Types#Post
*
* @package WooFramework
* @subpackage Template
*/
get_header();
?>
<!-- #content Starts -->
<?php woo_content_before(); ?>
<div id="content" class="col-full">
<div id="main-sidebar-container">
<!-- #main Starts -->
<?php woo_main_before(); ?>
<section id="main">
<header><h1 class="title"><?php single_post_title(); ?></h1></header>
<?php include 'book-query.php'; ?>
<?php
$title_before = '<h1 class="title">';
$title_after = '</h1>';
if ( ! is_single() ) {
$title_before = $title_before . '<a href="' . get_permalink( get_the_ID() ) . '" rel="bookmark" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">';
$title_after = '</a>' . $title_after;
}
$page_link_args = apply_filters( 'woothemes_pagelinks_args', array( 'before' => '<div class="page-link">' . __( 'Pages:', 'woothemes' ), 'after' => '</div>' ) );
woo_post_before();
?>
<article <?php post_class(); ?>>
<?php
woo_post_inside_before();
?>
<header>
<?php the_title( $title_before, $title_after ); ?>
</header>
<?php
//woo_post_meta();
?>
<section class="entry">
<?php
the_content();
wp_link_pages( $page_link_args )
?>
<hr />
<?php
echo do_shortcode('[custom_fields_block] [ct_filter terms="book"]ct_Accomplish_textarea_ac19[/ct_filter] [/custom_fields_block]')
?>
</section><!-- /.entry -->
<?php
//woo_post_inside_after();
?>
</article><!-- /.post -->
<?php
//woo_post_after();
//comments_template();
?>
</section><!-- /#main -->
<?php woo_main_after(); ?>
<?php get_sidebar(); ?>
</div><!-- /#main-sidebar-container -->
<?php get_sidebar('alt'); ?>
</div><!-- /#content -->
<?php woo_content_after(); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment