WordPress.org

Support

Support » Alpha/Beta » [Resolved] WP3.1 : custom post types templates

[Resolved] WP3.1 : custom post types templates

  • Hi, i’ve read there will be a new feature to have specific templates for custom post types; but I wasn’t able to find good explanations.
    in my code, i have

    register_post_type( 'yclad'
    ...
    'rewrite' => Array( 'slug' => _x('classified-ads','slug','yclads'), 'with_front' => false ),
    'has_archive' => true

    So If I well understood, with this;

    1. /classified-ads/ will be the rewritten url for this post type.
    2. archive-yclad.php should be the template loaded when accessing /wordpress/?post_type=yclad

    Is that correct ?

    BTW,
    /classified-ads/my-post works; but
    /classified-ads/ goes to 404.

    I did try to refresh the permalinks, and also to put

    flush_rewrite_rules( false );

    just after

    register_post_type(...

    It does not work.

    Also, is there a conditionnal tag to check if we are browsing a particular post type ?
    I would like a function to detect if we are on /wordpress/?post_type=yclad

    Is there something like is_archive(‘yclad’) ?

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] WP3.1 : custom post types templates’ is closed to new replies.
Skip to toolbar