Viewing 8 replies - 1 through 8 (of 8 total)
  • You could try adding the template tag for the plugin to this line in your CPT code:

    'supports'     => array( 'plugin_tag',

    Thread Starter JamieLe

    (@jamieleemi)

    Hi, the trouble is I used a plugin (CustomPress) to make the CPT instead of doing it manually through functions.php so I can’t modify the CPT the way you suggested.

    Can you think of any other way I might be able to do it?

    That’s the problem with plugins.

    Its very easy to create the CPT with code.

    You may need to consult the plugin author or remove the plugin and create your own CPT.

    add_action( 'init', 'wpsites_cpt_post_type' );
    function wpsites_cpt_post_type() {
    
    register_post_type( 'cpt',
        array(
            'labels' => array(
                'name'          => __( 'CPT', 'theme' ),
                'singular_name' => __( 'CPT', 'theme' ),
            ),
            'has_archive'  => true,
            'hierarchical' => true,
            'menu_icon'    => true,
            'public'       => true,
            'rewrite'      => array( 'slug' => 'cpt', 'with_front' => false ),
            'supports'     => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'revisions', 'page-attributes' ),
            'taxonomies'   => array( 'cpt-type' ),
    
        ));
    
    }

    And add taxonomies

    add_action( 'init', 'wpsites_register_taxonomy_types' );
    function wpsites_register_taxonomy_types() {
    
    register_taxonomy( 'cpt-type', 'cpt',
        array(
            'labels' => array(
                'name'          => _x( 'Types', 'taxonomy general name', 'theme' ),
                'add_new_item'  => __( 'Add New CPT Type', 'theme' ),
                'new_item_name' => __( 'New CPT Type', 'theme' ),
            ),
            'exclude_from_search' => true,
            'has_archive'         => true,
            'hierarchical'        => true,
            'rewrite'             => array( 'slug' => 'cpt-type', 'with_front' => false ),
            'show_ui'             => true,
            'show_tagcloud'       => false,
        ));
    
    }

    Then you could try adding the template tag for the plugin to this line in your CPT code.

    Thread Starter JamieLe

    (@jamieleemi)

    I think I’m a bit too far down the road to go back and remake the CPT. My CPT has about 20 custom taxonomies and five custom fields, then I have about 60 posts, each with lots of info and photos. I could really do with modifying the the plugin if possible.

    Thanks for your help though.

    Hi @brad. Is there a solution for people like Jimbo and me who already have created many CPTs?
    Thanks for your help!

    Thread Starter JamieLe

    (@jamieleemi)

    Josh, I’ve spoken to the developer on Twitter. The solution is the premium version: https://www.prelovac.com/products/seo-friendly-images/

    He says it supports CPTs. I haven’t bought it yet as I’m waiting for another plugin to be developed.

    Thanks @jimbo!
    I just bought the premium plugin. I’ll keep you posted…

    Thread Starter JamieLe

    (@jamieleemi)

    Thanks. Please let me know how you get on with it as I do plan to buy it, but the site I’m developing depends on this other plugin I’m waiting for.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Custom Post Types’ is closed to new replies.