Removing parent slug in hierachial custom post type

I was able to solve this problem by adding the code below under my theme/functions.php file. (My custom post type slug is ‘news’) function df_custom_post_type_link( $post_link, $id = 0 ) { $post = get_post($id); if ( is_wp_error($post) || ‘news’ != $post->post_type || empty($post->post_name) ) return $post_link; return home_url(user_trailingslashit( “$post->post_name” )); } add_filter( ‘post_type_link’, ‘df_custom_post_type_link’ , … Read more

Loop through Custom Post Type, and then show children within each iteration

Placing the following code within the WP_Query loop works: <?php $parent_page_id = ( ‘0’ != $post->post_parent ? $post->post_parent : $post->ID ); $mypages = get_pages( array( ‘child_of’ => $parent_page_id, ‘post_type’ => ‘programs’ ) ); foreach( $mypages as $page ) { $content = $page->post_content; if ( ! $content ) // Check for empty page continue; $content = … Read more

Hooking in to an archive page?

Use archive_template filter in your plugin to override archive templates for a given post type, for example, movies: <?php function get_movies_archive_template( $archive_template ) { if ( is_post_type_archive ( ‘movies’ ) ) { $archive_template = dirname( __FILE__ ) . ‘/templates/movies-archive-template.php’; } return $archive_template; } add_filter( ‘archive_template’, ‘get_movies_archive_template’ ) ; See archive_template in Codex.

Create custom PAGE with register_post_type

Your screenshot seems to indicate that you’re interested in the status message for your custom post type saying ‘Page updated. View page’. If that’s true, the reason that you’re getting ‘Post updated. View post’ is that you haven’t provided status messages for your custom post type. Here’s the code for the admin edit page (edit-form-advanced.php): … Read more

Unable to display list of custom posts

Your videoer post type will have a post archive at example.com/videor that lists all videoer posts You shouldn’t try to reinvent taxonomies using page templates. Instead use a custom taxonomy and call it something like videoer_category. Use the rewrite option on registration to change it to category and you’ll be able to have archives such … Read more