WordPress.org

Forums

[Plugin: Custom Field Template] How to assign a custom template on the front end? (4 posts)

  1. Anointed
    Member
    Posted 5 years ago #

    I am using a plugin called cms-press which allows me to create custom post_types with related taxonomies. That part works perfectly.

    I then tried verve meta boxes plugin, so that I could add in custom meta boxes for the post_type, but it does not work, as it only recognizes posts/pages

    So I tried custom-field-template today. It installed correctly, and I even noticed the input area:
    Custom Post Type (comma-deliminated):

    I entered in my post_type name there and sure enough all is working. I can go into my new admin UI for my custom post_type and the custom field template shows up perfectly, accepting data input.

    Where I am stuck
    I cannot figure out how to assign custom templates to the post_type 'custom' on the front end of the site

    Basically I am working on creating a new 'sermons' area where the template would look completely different than the rest of the site.

    In the past I used a custom plugin that allows me to assign templates to categories, and that works perfectly

    However:
    on my admin post_type input screen there is no choice for categories. This means I cannot assign the post to a category which in turn is assigned to a given template, both for the archives and single view.

    so....
    How do I assign an archive and single template to my custom post_type?

    thanks

    http://wordpress.org/extend/plugins/custom-field-template/

  2. jfelton
    Member
    Posted 5 years ago #

    I'd love to know this also. I used the custom post type ui to create types and taxonomies for sermons, and then I used the custom field template. Everything shows great in the admin side, but I can't get things to display on the frontend!

    Anyone know?

  3. 10sexyapples
    Member
    Posted 5 years ago #

    I'm using the same types of applications as both of you above with the nightly builds of 3.0. The custom post type code is still being wrangled around and really isn't set yet, so, using the plugins currently that are dealing with them will limit you to whatever was available at the time they were written. I have yet to find a plugin UI that is complete enough to implement, so, I am rolling my own in the functions file until the dust settles. It sounds like both of you need the page-attributes option in the supports array and don't have it, so it is defaulting to post, and as you know there is no option to designate a custom template in the post editor. If you are looking to have a single page template, then you can create one by naming it single-customposttypename.php and it will override single.php. Otherwise you will need to add the page-attributes in the support array. Here's an example:

    register_post_type(
                    'lessons',
                    array(
                            'label' => __('Lesson Plans'),
                            'public' => true,
                            'show_ui' => true,
                            'supports' => array(
                            			'title',
                            			'editor',
                            			'author',
                            			'page-attributes',
                                                    'thumbnail',
                                                    'excerpt',
                                                    'revisions')
                    )
            );

    code is a little weird looking, but, you get the point right?

  4. dronix
    Member
    Posted 5 years ago #

    the single-customposttypename.php works fine but your code example doesn't work for some reason. When I try to set a custom page temple it changes to default.

Topic Closed

This topic has been closed to new replies.

About this Topic