Skip to content

Instantly share code, notes, and snippets.

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 hawkidoki/639944bc8bc21efcc31abf0958be1989 to your computer and use it in GitHub Desktop.
Save hawkidoki/639944bc8bc21efcc31abf0958be1989 to your computer and use it in GitHub Desktop.
<?php
// Taxonomy
add_action('init', 'hwk_taxonomy_tax_example_register');
function hwk_taxonomy_tax_example_register() {
register_taxonomy('tax_example', array('example'), array(
'label' => __('Tax Example'),
'hierarchical' => false,
'public' => true
));
}
// Args: Remove Single View
add_filter('hwk/taxonomy/tax_example/args/no_single', '__return_true');
// Query
add_filter('hwk/taxonomy/tax_example/query', 'hwk_taxonomy_tax_example_query');
function hwk_taxonomy_tax_example_query($query){
$query->set('posts_per_page', -1);
$query->set('order', 'ASC');
return $query;
}
// Template
add_filter('hwk/taxonomy/tax_example/template', 'hwk_taxonomy_tax_example_template');
function hwk_taxonomy_tax_example_template(){
return 'templates/tax_example/archive.php';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment