Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Chrystl

    (@chrystl)

    Hi
    How did you create your custom post type, with a plugin or with a custom code?

    Thread Starter Marchetti Design

    (@afmarchetti)

    Hi Chrystl, with custom code (standard wordpress code for custom post type).

    <?php 
    
    /* ------------------------------------------------------------------------- *
     *   CUSTOM POST TYPE
    /* ------------------------------------------------------------------------- */	
    
    add_action('init', 'create_fullbase_area');
    function create_fullbase_area() {
    
        $labels = array(
            'name'               => __('Area', 'fullbase-plugin'),
            'singular_name'      => __('Area', 'fullbase-plugin'),
            'add_new'            => __('Add Area', 'fullbase-plugin'),
            'add_new_item'       => __('Add New Area', 'fullbase-plugin'),
            'edit_item'          => __('Edit Area', 'fullbase-plugin'),
            'new_item'           => __('New Area', 'fullbase-plugin'),
            'all_items'          => __('All Area', 'fullbase-plugin'),
            'view_item'          => __('View Area', 'fullbase-plugin'),
            'search_items'       => __('Search', 'fullbase-plugin'),
            'not_found'          => __('Slide Not found', 'fullbase-plugin'),
            'not_found_in_trash' => __('Slide Not found in the trash', 'fullbase-plugin'),
        );
    
        $args = array(
            'labels'             => $labels,
            'public'             => true,
            'rewrite'            => array('slug' => 'area' ),
            'has_archive'        => true,
            'hierarchical'       => true,
            'menu_position'      => 24,
            'show_ui' => true,
            'menu_icon' 		 => 'dashicons-images-alt2',
            'supports'           => array(
                                    'title',
                                    'editor'
                                    ),
    
        );
    
        register_post_type('fullbase_area', $args);
    }
    
    ?>
    Plugin Support Chrystl

    (@chrystl)

    Hi
    Could you please remove the ?> at the end of your code?

    I tested your code in a plugin with Polylang 1.8.5 and it works, see: https://nimb.ws/PtEsBO

    EDIT: I suggest you to copy/paste the below in a .php file and activate this plugin. Does it work?

    <?php
    /*
    Plugin name: TEST CPT FORUM
    */
    
        add_action('init', 'create_fullbase_area');
        function create_fullbase_area() {
    
            $labels = array(
                'name'               => __('Area', 'fullbase-plugin'),
                'singular_name'      => __('Area', 'fullbase-plugin'),
                'add_new'            => __('Add Area', 'fullbase-plugin'),
                'add_new_item'       => __('Add New Area', 'fullbase-plugin'),
                'edit_item'          => __('Edit Area', 'fullbase-plugin'),
                'new_item'           => __('New Area', 'fullbase-plugin'),
                'all_items'          => __('All Area', 'fullbase-plugin'),
                'view_item'          => __('View Area', 'fullbase-plugin'),
                'search_items'       => __('Search', 'fullbase-plugin'),
                'not_found'          => __('Slide Not found', 'fullbase-plugin'),
                'not_found_in_trash' => __('Slide Not found in the trash', 'fullbase-plugin'),
            );
    
            $args = array(
                'labels'             => $labels,
                'public'             => true,
                'rewrite'            => array('slug' => 'area' ),
                'has_archive'        => true,
                'hierarchical'       => true,
                'menu_position'      => 24,
                'show_ui' => true,
                'menu_icon' 		 => 'dashicons-images-alt2',
                'supports'           => array(
                                        'title',
                                        'editor'
                                        ),
    
            );
    
            register_post_type('fullbase_area', $args);
        }
    Thread Starter Marchetti Design

    (@afmarchetti)

    I try to eliminate the ?> but doesn’t works.

    The code is in a custom plugin with others 3 custom post types, i have the latest version of polylang install.

    Seems like polylang shows only 3 custom post type (the first 3 that are excecuted).

    3 is the number of the custom post type when i had activate for the first time polylang.

    What test i can make?

    Plugin Support Chrystl

    (@chrystl)

    Could you paste your code on https://pastebin.com/ and the link?

    Thread Starter Marchetti Design

    (@afmarchetti)

    Ok this is the code: https://pastebin.com/jWDeCurS

    The post type Test is the post with the problem

    Plugin Support Chrystl

    (@chrystl)

    I tested your code and the CPT ‘Test’ works for me.

    Could you edit the file wp-config.php in your WordPress root directory and replace

    define( 'WP_DEBUG', false );

    by

    define( 'WP_DEBUG', true );

    This maybe display an error message in the debug.log.

    Thread Starter Marchetti Design

    (@afmarchetti)

    I have wp debugger already on, what i can do?

    it’s a big problem for me, i see the post in the settings of polylang but not in the menu..

    Thread Starter Marchetti Design

    (@afmarchetti)

    ok i find the problem the attribute:

    ‘menu_position’ => 24,

    was the same on 2/3 custom post type now it works!

    thank you,
    have a nice day.

    Plugin Support Chrystl

    (@chrystl)

    Ok, thanks for the feeback. Could you please mark your topic as “resolved”? Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Not able to create Custom Post type after install the plugin’ is closed to new replies.