Skip to content

Instantly share code, notes, and snippets.

View jymartineau's full-sized avatar
💭
I may be slow to respond.

JY Martineau jymartineau

💭
I may be slow to respond.
View GitHub Profile
@jymartineau
jymartineau / gist:dc7be3f37d184e9216f2
Created May 12, 2015 15:08
Get taxonomy for Custom Post Type - Wordpress
<?php
$args = array( 'hide_empty=0' );
$terms = get_terms( 'category', $args );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
$count = count( $terms );
$i = 0;
$term_list = '<p class="my_term-archive">';
foreach ( $terms as $term ) {
@jymartineau
jymartineau / gist:725fe2535a463f573695
Created May 12, 2015 16:42
Add Custom Post Type Categories to General Categories Archive - Wordpress
//Add Custom Post Type Categories to General Categories Archive
function add_custom_types_to_tax( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
// Get all your post types
$post_types = get_post_types();
$query->set( 'post_type', $post_types );
return $query;
}
@jymartineau
jymartineau / gist:685651f11ddd1211b260
Created May 12, 2015 16:55
How to Add a Featured Image Column to WordPress Dashboard
//Add a Featured Image Column to WordPress Dashboard
add_filter('manage_posts_columns', 'posts_columns', 5);
add_action('manage_posts_custom_column', 'posts_custom_columns', 5, 2);
function posts_columns($defaults){
$defaults['riv_post_thumbs'] = __('Featured Image');
return $defaults;
}
function posts_custom_columns($column_name, $id){
if($column_name === 'riv_post_thumbs'){
echo the_post_thumbnail(array(100,100));