WordPress.org

Ready to get started?Download WordPress

Forums

SEO Friendly Images
Custom Post Types (9 posts)

  1. Jimbo
    Member
    Posted 2 months ago #

    Hi, I thought this wasn't working until I realised it was only on my CPTs.

    Anyone know how to get this woking with a custom post type?

    Thanks.

    https://wordpress.org/plugins/seo-image/

  2. WP Sites - Brad Dalton
    Member
    Posted 2 months ago #

    You could try adding the template tag for the plugin to this line in your CPT code:

    'supports'     => array( 'plugin_tag',
  3. Jimbo
    Member
    Posted 2 months ago #

    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?

  4. WP Sites - Brad Dalton
    Member
    Posted 2 months ago #

    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.

  5. Jimbo
    Member
    Posted 2 months ago #

    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.

  6. Josh Fialkoff
    Member
    Posted 2 months ago #

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

  7. Jimbo
    Member
    Posted 2 months ago #

    Josh, I've spoken to the developer on Twitter. The solution is the premium version: http://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.

  8. Josh Fialkoff
    Member
    Posted 2 months ago #

    Thanks @Jimbo!
    I just bought the premium plugin. I'll keep you posted...

  9. Jimbo
    Member
    Posted 2 months ago #

    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.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.