• Hello there,

    first, thanks a lot for your great plugin.

    would it be possible to add argument

    'show_in_rest' => true,

    in /lib/classes/TSSProInit.php where you register the testimonial custom post type
    in between lines 130 – 170

    this way users can enable the gutenberg editor via a short filter in functions.php

    if ( ! function_exists( 'ww_activate_block_editor' ) ) :
    
        function ww_activate_block_editor($can_edit, $post_type){
            if($post_type == 'testimonial'){
            $can_edit = true;
            }
            return $can_edit;
        }
    
        add_filter('use_block_editor_for_post_type', 'ww_activate_block_editor', 10, 2);
    
    endif;

    that would be awesome ??

    thanks, greetings
    & keep up the good work!
    Becki

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support SM Rafiz

    (@srafiz)

    Hi @becki

    Please paste the below codes to your child theme’s functions.php to activate the Gutenberg editor for the Testimonial Custom Post Type.

    /**
     * Gutenberg activation.
     *
     * @param array  $args Post Type Args.
     * @param string $post_type Post Type.
     * @return array
     */
    function tlp_testimonial_post_type_args( $args, $post_type ) {
    	if ( $post_type !== TSSPro()->post_type ) {
    		return $args;
    	}
    
    	$args['show_in_rest'] = true;
    
    	return $args;
    }
    
    add_filter( 'register_post_type_args', 'tlp_testimonial_post_type_args', 10, 2 );

    Thank you.

    Thread Starter Becki Beckmann

    (@becki)

    Hey @srafiz

    thanks for pointing me to the proper hook.
    wasn’t aware of the filter ‘register_post_type_args’

    thanks
    & greetings
    Becki

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘show_in_rest to enable gutenberg editor via functions.php’ is closed to new replies.