Numeric pagination custom post type

You’re referencing the global $wp_query object in your function which you’ve reset using wp_reset_query(). You can resolve the pagination by passing your custom $loop WP_Query object to the function. I also changed wp_reset_query to wp_reset_postdata Also you’re making the call to your pagination function in the while loop instead of after it. Your function should … Read more

Showing current taxonomy terms

try this: <?php get_header(); ?> <? // get the current term $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); <div class=”container” role=”main”> <h1 class=”entry-title”><?php echo $term->name; ?></h1> <div class=”entry-content ref”> <?php $loop = new WP_Query( array( ‘post_type’ => ‘references’ , ‘genre’ => $term->slug) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); … Read more

Title_save_pre – Simple problem that u know for sure

Try the code below. Filter’s take a value and returns it afterwards. <?php function muda_titulo($title) { global $post; $type = get_post_type($post->ID); if ($type== ‘event’) { $title = $post->post_excerpt; $day= get_the_time(‘l, d F, Y’); return $title.’ – ‘.$day; } else if ($type == ‘post’) { return $title; } } add_filter (‘title_save_pre’,’muda_titulo’); ?>

custom post types, wp_get_archives and add_rewrite_rule

Custom post types do not have date-based archives by default (by which I really mean they don’t have permalink structures for their date archives). For example: www.example.com?post_type=journal&year=2012&monthnum=4 should give you the archive of journals published in April 2012. However, www.example.com/journal/2012/04 will probably give you 404 because it doesn’t exist as a re-write rule. You need … Read more

how to group custom post type posts by custom taxonomy terms

try using this fancy function that group the posts by term id that Scribu and Mike created: function event_clauses( $clauses, $wp_query ) { global $wpdb; if ( isset( $wp_query->query[‘orderby’] ) && ‘event_location’ == $wp_query->query[‘orderby’] ) { $clauses[‘join’] .=<<<SQL LEFT OUTER JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID={$wpdb->term_relationships}.object_id LEFT OUTER JOIN {$wpdb->term_taxonomy} USING (term_taxonomy_id) LEFT OUTER JOIN {$wpdb->terms} USING … Read more

When you create a custom post type, does that also create capabilities for editing/deleting that post type automatically?

It does not automatically create that capability in the sense that there is no new capability registered with WordPress. Instead it defaults to use the capabilities assigned to creating/editing posts. For example, if an author logs in they will be able to create and publish a new destination entry by default. You can override this … Read more