John
Post up the code that you have used to register the post type ‘articles’ as well.
Check that its inside the php tags, also that you have
register_post_type( 'articles', $args );
Where you are registering the custom post type and not ‘article’ or ‘book’ if you have used sample code from WP
Hi there
I haven’t registered them – Which file do I add that too ?
This is the plugin I used to create Custom Post Types
http://wordpress.org/plugins/types/
Cheers
John
You would add that to your functions.php. It entirely depends on what your trying to achieve. If you have started with this plugin see if you can get it too work. The plugin has taken care of registering the posts for you.
I dont know the plugin but the first thing i would do to start, is hover your mouse over the articles menu item in the admin right click, copy link and paste it somewhere to see what the link is. It will look something like this
http://www.YOUR_DOMAIN_NAME.co.uk/wp-admin/edit.php?post_type=articles
where “articles” may be something like “types_articles” or have some other prefix.
Whatever that says after the = is what you need to have in this code as your post types. My guess is your plugin probably gives them some fancy name for identifying them.
*
* @param array $post_types An array of post type names that the templates be used by
* @return array The array of post type names that the templates be used by
**/
function my_cpt_post_types( $post_types ) {
$post_types[] = 'WHATEVER_AFTER_EQUALS_SIGN';
return $post_types;
}
add_filter( 'cpt_post_types', 'my_cpt_post_types' );
If that doesn’t work then you may want to consider creating your articles custom post type without the plugin by registering a custom post in the functions.php of your child theme.
Thank You so much 🙂
I needed ‘article’ not ‘articles’
All working fine
Cheers
John
I use this code for registering the post type:
function codex_custom_init() {
$settings_options = array(
'args' => array(
'label' => __( 'Book', 'domainid' ),
'public' => true,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),
'publicly_queryable' => true,
'has_archive' => true
),
'id' => 'book'
);
register_post_type( $settings_options['id'], $settings_options['args'] );
}
add_action( 'init', 'codex_custom_init' );
And the Custom Post Type box does not show… How can I fix this, without the filter?
Do I need to add a value to supports array?