Prepend regular Posts with custom slug, without affecting Custom Post Types?

Use the register_post_type_args filter to alter post types registered by code you don’t control. You can set it for a specific type: add_filter( ‘register_post_type_args’, ‘wpd_change_post_type_args’, 10, 2 ); function wpd_change_post_type_args( $args, $post_type ){ if( ‘turnips’ == $post_type ){ $args[‘rewrite’][‘with_front’] = false; } return $args; } Or remove that $post_type check to change it for all … Read more

WP_Query to loop a Custom Field, Custom Post Types do not show

There’s a missing opening quote and closing bracket on this line: <i class=<?php the_field(‘course_feature_icon’); ?>”</i> Needs to be: <i class=”<?php the_field(‘course_feature_icon’); ?>”></i> That’s all that’s wrong with your code. It should then work assuming: You have a custom field, course_feature_icon, whose value is a valid CSS class. You have the necessary CSS to add an … Read more

Is it possible to remove the posts_per_page limit on a specific post type?

You can hook into the pre_get_posts action, to access the $query object. You should use your action hook inside your functions.php. An example of what your function could look like: add_action( ‘pre_get_posts’, ‘publications_archive_query’ ); function publications_archive_query( $query ) { if ( !is_admin() && $query->is_main_query()) { if ( $query->get(‘post_type’) === ‘publications’ ) { $query->set( ‘posts_per_page’, 5 … Read more

Custom post type permalink changing itself every other change

BETTER SOLUTION Actually, there is a note on the WP_Query reference: Note: Ticket #18408 For querying posts in the admin, consider using get_posts() as wp_reset_postdata() might not behave as expected. So instead of attempting to reset the global post data, the more proper solution is either: Use get_posts(): $seriesPosts = get_posts($args); foreach($seriesPosts as $p){ $select … Read more

How to show the taxonomy assigned to a post in the table (where all the posts are displayed) of the custom post type?

Using my test site and some test code this is what I think you were looking for? (source: mikeschinkel.com) To achieve this you need to use two (2) hooks, one being specific to your post type: ‘manage_static_content_posts_columns’ and ‘manage_posts_custom_column’. In order to make it work I took your code and packaged it in a class, … Read more

Get monthly archives for custom post type

You can use getarchives_where hook of wp_get_archives() function Add this function to your functions.php: function Cpt_getarchives_where_filter( $where , $r ) { $post_type=”blog”; return str_replace( “post_type=”post”” , “post_type=”$post_type”” , $where ); } Then when you want your monthly archive put this: add_filter( ‘getarchives_where’ , ‘Cpt_getarchives_where_filter’ , 10 , 2 ); wp_get_archives(); remove_filter(‘getarchives_where’ , ‘Cpt_getarchives_where_filter’ , 10 … Read more