• Hi FPS,

    Genius plug-in. I’ve used custom content type manager to create a new content type called “clients”. My custom fields include text fields only. Seems pretty straight-forward.

    When I view the sample template, the title, content & thumbnail exist, but none of the custom fields display. I’m sure I’m doing something wrong. Any suggestions?

    get_header(); ?>

    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

    <h1><?php the_title(); ?></h1>
    <?php the_content(); ?>
    <?php the_post_thumbnail(); ?>

    <h2>Custom Fields</h2>

    <?php endwhile; // end of the loop. ?>

    http://wordpress.org/extend/plugins/custom-content-type-manager/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Looks like you’re not printing your custom fields — every time you make custom content, you also need to have a custom template. I built the “sample template” functionality to demonstrate a simple use case. Maybe you need to review the sample template page after having added a few custom fields… or maybe there’s a bug there. In any case, all you need to do to print your custom fields is to use one of the Template Functions (see the wiki: http://code.google.com/p/wordpress-custom-content-type-manager/wiki/TemplateFunctions#print_custom_field) — specifically the “print_custom_field()” function is your friend when it comes to printing simple text fields. Just reference them by name, e.g.

    <h2>Custom Fields</h2>
    <?php print_custom_field('my_textfield1'); ?>
    <?php print_custom_field('my_textfield2'); ?>
    <?php print_custom_field('my_textfield3'); ?>
    Thread Starter blue522

    (@blue522)

    Thanks so much FPS,

    Yes, I do have the custom fields yet they are not firing off in the template for some reason. I appreciate the manual work-around.

    Thanks also for the speedy response, very kind of you.

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Sure. Just to be clear, adding fields to your custom post type does not cause your template to be updated automatically: when you view the sample template, it just shows you what you _could_ copy and paste into your template file in order to display the data. If you have fields added to your post type, and viewing the sample template does not show those fields, then that sounds like a bug, and it’d be great if you could do a screencast and outline the exact steps to reproduce this error and then file it in the bug tracker (click on the link in the footer of your CCTM dashboard pages).

    Thanks.

    Thread Starter blue522

    (@blue522)

    NO BUG. User error.

    I created the custom fields but did not “activate” them with the check box to be included.

    Sorry for the false alarm.

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Tee hee. Ok, good to know. Maybe I should update the sample template to include a comment about that… the normalized architecture here can be confusing, especially to newcomers.

    So the lesson here is that defining a custom field is completely independent from associating it with a post-type. You can define a filed once, then add it to multiple post-types. That makes for less work in the long-run, but in the short-term, it can be confusing. Maybe I should add a section in the field definition that can let you immediately associate a field with a post-type(s).

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: Custom Content Type Manager] View Sample Template does not include custom fields’ is closed to new replies.