• Resolved erwanpia

    (@erwanpia)


    Hi, I am willing to manage custom blocks using custom post widget plugin, that creates a new custom post type. I have managed to let Elementor acknowledge the new custom post type by making the latter public (code below), but Elementor seems to bug with this custom post type, when clicking “edit with elementor” in the custom post edit page, it displays the home page instead of the custom content, url is the following, without the post id : https://dev.local/?content_block=footer&elementor

    any idea how to solve this ? thanks

    code to make custom post widget public and acceptable by elementor config page:

    function filter_content_block_init()
    {
    	$content_block_public = true;
    	return $content_block_public;
    	}
    
    add_filter('content_block_post_type','filter_content_block_init');

    https://www.ads-software.com/plugins/elementor/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Yakir Sitbon

    (@kingyes)

    Please paste here all your register_post_type() code for your CPT.

    Thread Starter erwanpia

    (@erwanpia)

    direct from custom post widget plugin

    https://plugins.svn.www.ads-software.com/custom-post-widget/trunk/post-widget.php

    // Create the Content Block custom post type
    function cpw_post_type_init() {
    	$labels = array(
    		'name' => _x( 'Content Blocks', 'post type general name', 'custom-post-widget' ),
    		'singular_name' => _x( 'Content Block', 'post type singular name', 'custom-post-widget' ),
    		'plural_name' => _x( 'Content Blocks', 'post type plural name', 'custom-post-widget' ),
    		'add_new' => _x( 'Add Content Block', 'block', 'custom-post-widget' ),
    		'add_new_item' => __( 'Add New Content Block', 'custom-post-widget' ),
    		'edit_item' => __( 'Edit Content Block', 'custom-post-widget' ),
    		'new_item' => __( 'New Content Block', 'custom-post-widget' ),
    		'view_item' => __( 'View Content Block', 'custom-post-widget' ),
    		'search_items' => __( 'Search Content Blocks', 'custom-post-widget' ),
    		'not_found' =>  __( 'No Content Blocks Found', 'custom-post-widget' ),
    		'not_found_in_trash' => __( 'No Content Blocks found in Trash', 'custom-post-widget' )
    	);
    	$content_block_public = false; // added to make this a filterable option
    	$options = array(
    		'labels' => $labels,
    		'public' => apply_filters( 'content_block_post_type', $content_block_public ),
    		'publicly_queryable' => false,
    		'exclude_from_search' => true,
    		'show_ui' => true,
    		'query_var' => true,
    		'rewrite' => true,
    		'capability_type' => 'post',
    		'hierarchical' => false,
    		'menu_icon' => 'dashicons-screenoptions',
    		'supports' => array( 'title','editor','revisions','thumbnail','author' )
    	);
    	register_post_type( 'content_block',$options );
    }
    add_action( 'init', 'cpw_post_type_init' );

    The problem I see here it’s publicly_queryable is equal to false,
    so the content block doesn’t give access to the front end.

    Another issue here the plugin widget will render the post content not the actual builder content and style, the result will be raw html without any style.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘custom post widget and elementor compatibility’ is closed to new replies.