WordPress.org

Ready to get started?Download WordPress

Forums

Custom Content Type Manager
[resolved] thumbnail support (16 posts)

  1. natcl
    Member
    Posted 2 years ago #

    Is it possible to have thumnail (ie featured image) support for Custom posts ?
    I read on a forum that it's possible by adding this to functions.php :

    add_theme_support( 'post-thumbnails', array( 'post','custom-post-type-here','another-custom-post-type' ) );

    That I can do, but it seems that it is also required to specify thumbnail support when registrering the custom post type:
    'supports' => array( 'title', 'editor', 'comments', 'excerpt', 'custom-fields', 'thumbnail' ),

    I assume this needs to be done by CPTM

    Thanks !

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

  2. fireproofsocks
    Member
    Plugin Author

    Posted 2 years ago #

    That's already implemented:

    1. Create/edit a custom post type under the CCTM --> Custom Content Types menu.
    2. Head to the "Fields" tab
    3. Check the "Page Attributes" checkbox
    4. Check the "Thumbnail" box

    It's currently dynamically hidden (which was a dumb UI choice on my part), so it's hard to find. I'm trying to make it grey out instead of hiding it completely.

    You'll still have to add the add_theme_support() function to your themes, though. When you register the post-type, adding thumbnail support just means you get that option displayed in the Page Attributes meta-box, but your theme needs the add_theme_support() stuff in order to be able to actually use that info.

  3. natcl
    Member
    Posted 2 years ago #

    Ahhh nice, now everything works nicely, thanks a lot !

  4. fireproofsocks
    Member
    Plugin Author

    Posted 2 years ago #

    You're welcome.

  5. zoomzoom2
    Member
    Posted 2 years ago #

    Hi,

    How can I display thumbnails in CCTM lists (like in ths summarize widget), where the thumbnail has not been selected via custom fields but via the wordpress thumbnail box? I assume that there is not a specific placeholder but is there aby possibility?

    thanks

  6. fireproofsocks
    Member
    Plugin Author

    Posted 2 years ago #

    If you are using the built-in "Featured Image" on your posts, then what you're actually doing is using a "standard" WordPress custom field, whose name is "_thumbnail_id". The Summarize Posts query will include that data and it will return 2 bits of data for you: thumbnail_src and thumbnail_id (that's more useful in the PHP invocations, not for shortcodes). You can manipulate your formatting string to use the thumbnail_src attribute. If you're using the shortcode, you can do something like:

    [summarize_posts]
    [+post_title+]
    <img src="[+thumbnail_src+]" />
    [/summarize_posts]

    Remember that if you ever wonder what placeholders are available to you, use the [+help+] placeholder and you'll get a list of all available placeholders.

    Hope that helps.

  7. zoomzoom2
    Member
    Posted 2 years ago #

    tahnks a lot it works great!

  8. jumust
    Member
    Posted 2 years ago #

    Hi,
    I checked the "Page Attributes" and the box "thumbnail"
    also added to functions.php
    add_theme_support( 'post-thumbnails', array( 'post','arte-antichita','turismo' ) );

    But in the custom post admin I can only see the Attribute box with Sorting field...no featured image.

    My theme displays the featured image in posts with
    <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('blog-post');?></a>

    so somewhere there should be post-thumbnails registered but can't find.
    Any idea how to solve this?

  9. fireproofsocks
    Member
    Plugin Author

    Posted 2 years ago #

    Sorry for the delayed response, I was not receiving notifications from WP :(

    Not sure what you're referring to by "custom post admin"... you mean when you're viewing a list of posts, e.g. @ http://yoursite.com/wp-admin/edit.php?post_type=your_post_type ?

    If there's a bug, please file it in the bug-tracker: http://code.google.com/p/wordpress-custom-content-type-manager/issues/list

  10. circa1978
    Member
    Posted 1 year ago #

    Trying to get the post-thumbnails metabox to show up on a custom post type I created through the plugin. I have added the following line to my functions.php

    add_theme_support( 'post-thumbnails', array( 'course' ) );

    Where course represents my custom post type. Them then enabled post-thumbnails as described above. I only see the page attributes metabox, not the featured image metabox on the post editing page.

    If I add a built in post type to the add theme support line above, I get the thumbnail metabox on the edit screen. It just fails on the custom post types created from the plugin. Am I missing something or is this a bug?

  11. fireproofsocks
    Member
    Plugin Author

    Posted 1 year ago #

    Did you ensure that your Screen Options are set to display the Featured Image as pictured here: http://screencast.com/t/Gop7I45W0

  12. circa1978
    Member
    Posted 1 year ago #

    Wow, thanks for the quick reply. Unfortunately, it doesn't show up there. I see 'Attributes' but no 'Featured Image'.

    I just doubled checked all the settings.

    1. My custom post type is called simply 'course'
    2. I have added the following line to functions.php add_theme_support( 'post-thumbnails', array( 'course' ) );
    3. I have enabled Thumbnails in the Fields settings of my post type course

    I think that is all that needed to be done to make it show up, but it doesn't show on the edit page and isn't listed in the screen options of the edit page.

  13. fireproofsocks
    Member
    Plugin Author

    Posted 1 year ago #

    Hmm... Don't know what to tell you... I don't think it's a bug (I can't reproduce the issue)... I would try disabling all other plugins and try using a default WP theme to see if the problem continues (WP themes can be equivalent to plugins, so they're just as likely to be culprits in messing up expected behavior).

    When you click on the CCTM's "Report a Bug" link, there's a big box of useful info there that can help me troubleshoot environment issues.

  14. circa1978
    Member
    Posted 1 year ago #

    Figured it out. I was using a child theme and there was a conflicting "add_theme_support" in the parent theme. Once I added my custom post type to the add_theme_support function in the parent theme, it showed up in the child theme. Thanks for your help and speedy replies. I'll send you a paypal thank you, hopefully others who get your help will do the same. Thanks.

  15. fireproofsocks
    Member
    Plugin Author

    Posted 1 year ago #

    Ah, Child Themes... my nemesis. Glad you got it figured out. Donations are always appreciated!

  16. fireproofsocks
    Member
    Plugin Author

    Posted 1 year ago #

    Marking this as resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic