File: /mnt/data/mentoring-wp/wp-content/plugins/mentoringcpt/mentoringcpt.php
<?php
/**
* Plugin Name: Mentoring CPT
* Description: creating the post types for mentoring theme.
* Version: 1.2.9
* Author: Dreams Technologies
* Text Domain: mentoring_cpt
* * Domain Path: /languages
*
*/
// Our custom post type function
function mentoring_posttype() {
register_post_type( 'testimonials',
// CPT Options
array(
'labels' => array(
'name' => __( 'Testimonial','mentoring_cpt' ),
'singular_name' => __( 'testimonials' ,'mentoring_cpt')
),
'public' => true,
'has_archive' => true,
'supports' => array('title','editor','thumbnail','custom-fields','excerpt'),
'rewrite' => array('slug' => 'testimonial'),
'show_in_rest' => true,
)
);
register_post_type( 'portfolio',
// CPT Options
array(
'labels' => array(
'name' => __( 'Portfolio' ,'mentoring_cpt' ),
'singular_name' => __( 'Portfolio','mentoring_cpt' )
),
'public' => true,
'has_archive' => true,
'supports' => array('title','editor','thumbnail'),
'rewrite' => array('slug' => 'portfolio'),
'show_in_rest' => true,
)
);
}
// Hooking up our function to theme setup
add_action( 'init', 'mentoring_posttype' );
/**
* Load plugin textdomain.
*
* @since 1.0.0
*/
/**
* Deactive plugin
*
* @throws error
* @return
*/
if( !function_exists('mentoring_cpt_load_textdomain') ) {
add_action( 'init', 'mentoring_cpt_load_textdomain' );
function mentoring_cpt_load_textdomain() {
load_plugin_textdomain( 'mentoring_cpt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
}