Page Template as Custom Post Type Archive

Since WordPress version 4.4 the hook ‘theme_page_templates’ allows to set arbitrary page templates. It means that it’s possible to show arbitrary values in the “Page Template” menu of the page edit screen, and when selected, the value will be stored in the page template meta for the page. This means that you can “automagically” create … Read more

How to force one column layout on custom post type edit page?

There is a filter called get_user_option_meta-box-order_{$page} where $page is the name of the post type. Just make sure that submitdiv is the last value in the array: add_filter( ‘get_user_option_meta-box-order_post’, ‘wpse25793_one_column_for_all’ ); function wpse25793_one_column_for_all( $order ) { return array( ‘normal’ => join( “,”, array( ‘postexcerpt’, ‘formatdiv’, ‘trackbacksdiv’, ‘tagsdiv-post_tag’, ‘categorydiv’, ‘postimagediv’, ‘postcustom’, ‘commentstatusdiv’, ‘slugdiv’, ‘authordiv’, ‘submitdiv’, ) … Read more

Displaying a custom post type alphabetically

try this: <?php $args = array( ‘post_type’ => ‘tenant’, ‘posts_per_page’=>5, ‘orderby’=>’title’,’order’=>’ASC’); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> You will find more info o custom queries here: http://codex.wordpress.org/Class_Reference/WP_Query

What are the differences between custom post type and custom page templates?

Taxonomies are categorizations of data. Tags are a taxonomy. Categories are another taxonomy. If you are building a movie website and want to show which actors starred in which movie, “Movies” would be a custom taxonomy. Custom Post Types are really just custom data items. They’re stored just like posts and pages, but aren’t considered … Read more

Custom post types – Use post_id in permalink structure

@Bainternet – your answer didn’t fully work but I did some more searching and was able to piece this filter together that did work: add_filter(‘post_type_link’, ‘custom_event_permalink’, 1, 3); function custom_event_permalink($post_link, $id = 0, $leavename) { if ( strpos(‘%event_id%’, $post_link) === ‘FALSE’ ) { return $post_link; } $post = &get_post($id); if ( is_wp_error($post) || $post->post_type != … Read more

register_post_type sort order by title by default

You could force the order via pre_get_posts: function wpa_order_states( $query ){ if( !is_admin() ) return; $screen = get_current_screen(); if( ‘edit’ == $screen->base && ‘states’ == $screen->post_type && !isset( $_GET[‘orderby’] ) ){ $query->set( ‘orderby’, ‘title’ ); $query->set( ‘order’, ‘ASC’ ); } } add_action( ‘pre_get_posts’, ‘wpa_order_states’ );