Custom Post Type formatting problem

  • MeMeMe

    #6689

    First, I love the graphene theme. However, I find it very hard to figure out what’s going in within its loop and single files.

    I have created a bunch of custom post types. What I want with some of these, is to use the same single.php and loop-single,php files to display the custom post types when viewed, so that they are styled identically to normal posts.

    Unfortunately those posts belonging to the custom post types are missing data: the date, the comments section, tags, and maybe other stuff.

    What I think is happening is that it is doing a conditional check, and if a post is of type “post” it is including that stuff, and if post is not of that type, it is being excluded. I can’t find what I need to alter so that it also does this for my custom post types.

    Can anyone help?

    MeMeMe

    #35255

    Update: I’ve solved my two problems (date and comments not being shown). In case anyone else has the same problems:

    For dates:

    I’ve found that in the theme-loop.php file there is this line in the graphene_should_show_date() function :

    $allowed_posttypes = apply_filters( 'graphene_date_display_posttype', array( 'post' ) );

    If I change it to:

    $allowed_posttypes = apply_filters( 'graphene_date_display_posttype', array( 'post' , 'my_custom_post_type') );

    then the date is shown on my custom post.

    I copied this function to my child themes functions.php and modified it, and now it works okay.

    For comments:

    I was using a plugin for registering custom post types, and it doesn’t set the comments visibility property properly.

    Admin

    Syahir Hakim

    #35256

    Instead of copying the entire function to your child theme, use this instead in your child theme:

    function custom_date_display_posttype( $types ) {
    $types[] = 'my_custom_post_type';
    return $types;
    }
    add_filter( 'graphene_date_display_posttype', 'custom_date_display_posttype' );

    MeMeMe

    #35257

    Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.