Last active
August 29, 2015 14:06
-
-
Save mrwweb/8330875573758f85f108 to your computer and use it in GitHub Desktop.
These three files should go in a child theme of the WP Advocate theme if using the People Profile CPT to show individual People Category taxonomy archive pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<header class="entry-header clearfix"> | |
<h1 class="entry-title"><?php echo single_term_title(); ?></h1> | |
</header><!-- .entry-header --> | |
<?php | |
$term_description = term_description(); | |
if( $term_description ) : ?> | |
<div class="entry-content post-content"> | |
<?php echo $term_description; ?> | |
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'wp-advocate' ), 'after' => '</div>' ) ); ?> | |
</div><!-- .entry-content --> | |
<?php endif; ?> | |
</article><!-- #post-<?php the_ID(); ?> --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// modify people profile cpt "People Category" taxonomy to show up in People posts table | |
// and be at example.org/people/{people_category} instead of example.org/people_category/{people_category} | |
function wpa_modify_people_category_taxonomy() { | |
// get the arguments of the already-registered taxonomy | |
$people_category_args = get_taxonomy( 'people_category' ); // returns an object | |
// make changes to the args | |
// in this example there are three changes | |
// again, note that it's an object | |
$people_category_args->show_admin_column = true; | |
$people_category_args->rewrite['slug'] = 'people'; | |
$people_category_args->rewrite['with_front'] = false; | |
// re-register the taxonomy | |
register_taxonomy( 'people_category', 'people', (array) $people_category_args ); | |
} | |
// hook it up to 11 so that it overrides the original register_taxonomy function | |
add_action( 'init', 'wpa_modify_people_category_taxonomy', 11 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<?php | |
if (get_theme_mod('wp_advocate_intro_bg')) { | |
$intro_class = 'intro-copy-box-wrap-nobg'; | |
} else { | |
$intro_class = 'intro-copy-box-wrap'; | |
} | |
?> | |
<div class="<?php echo $intro_class; ?>"> | |
<div class="intro-copy-box"> | |
<?php | |
get_template_part( 'content', 'taxonomy-head' ); | |
?> | |
</div> | |
</div> | |
<div id="content" class="people-main clearfix"> | |
<div id="main" class="clearfix" role="main"> | |
<?php if (post_type_exists('people')) : ?> | |
<?php | |
if ( get_query_var('paged') ) { | |
$paged = get_query_var('paged'); | |
} elseif ( get_query_var('page') ) { | |
$paged = get_query_var('page'); | |
} else { | |
$paged = 1; | |
} | |
?> | |
<?php if ( have_posts() ) : ?> | |
<div id="grid-wrap" class="clearfix"> | |
<?php /* Start the Loop */ ?> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<div class="grid-box"> | |
<?php | |
/* Include the Post-Format-specific template for the content. | |
* If you want to overload this in a child theme then include a file | |
* called content-___.php (where ___ is the Post Format name) and that will be used instead. | |
*/ | |
get_template_part( 'content', 'people' ); | |
?> | |
</div> | |
<?php endwhile; ?> | |
</div> | |
<?php if (function_exists("wp_advocate_pagination")) { | |
wp_advocate_pagination(); | |
} elseif (function_exists("wp_advocate_content_nav")) { | |
wp_advocate_content_nav( 'nav-below' ); | |
}?> | |
<?php wp_reset_postdata(); ?> | |
<?php else : ?> | |
<article id="post-0" class="post no-results not-found"> | |
<header class="entry-header"> | |
<h1 class="entry-title"><?php _e( 'No People Found!', 'wp-advocate' ); ?></h1> | |
</header><!-- .entry-header --> | |
<div class="noimg"></div> | |
<div class="entry-content post-content"> | |
<p><?php _e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'wp-advocate' ); ?></p> | |
<?php get_search_form(); ?> | |
</div><!-- .entry-content --> | |
</article><!-- #post-0 --> | |
<?php endif; ?> | |
<?php else : ?> | |
<article id="post-0" class="post no-results not-found"> | |
<header class="entry-header"> | |
<h1 class="entry-title"><?php _e( 'No People Found!', 'wp-advocate' ); ?></h1> | |
</header><!-- .entry-header --> | |
<div class="noimg"></div> | |
<div class="entry-content post-content"> | |
<p><?php _e( 'Please make sure that the WP advocate People CPT Plugin is installed and activated.', 'wp-advocate' ); ?></p> | |
</div><!-- .entry-content --> | |
</article><!-- #post-0 --> | |
<?php endif; ?> | |
</div> <!-- end #main --> | |
<?php // get_sidebar(); ?> | |
</div> <!-- end #content --> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment