CPT created and put in Upfront layout does not display

SLS needed. Access details in chat.
When I put the CPT created with CustomPress in Upfront layout and save, it does not show in existing layouts. Also, when trying to edit the layout, I get some weird content symptoms.
Getting the following JS console output - https://goo.gl/hSfMLN

    Mahlamusa

    Hi LZ,

    I hope you are doing great today and thank you for contacting us about the issue. I am very sorry for the delayed response from our side regarding this issue and we hope to resolve it soon.

    Firstly, I am sorry about the empty post above with only the "H", it was supposed to be a nice greeting and this whole post but my computer got frozen while I was typing then I accidentally pressed send, unfortunately there is no undo. Sorry for the inconvenience that may have caused.

    I had a chance to look into your website's configuration and have found that if I create a new theme with Upfront Builder and then create a new layout for the product custom post type created, I can create and save a layout but once I navigate away from the page (even if I stay) and then come back to edit the previously saved layout, it does not appear in the list of editing existing layouts. If I understood correctly, this is the issue you are reporting, please confirm.

    This seems to be a bug, but I can't confirm so far. I will do some further tests and ask my colleagues if they know any reports about this. I will update on this thread once I found something.

    In the meantime, you can edit the previously created layout by choosing to create a new layout using the same "Single Product" option, this does not delete but it loads the already saved one so you can continue from where you left off.

    Please let us know if you need help with any thing else.

    Have a nice day.

    Cheers,
    Mahlamusa

    Mahlamusa

    Hello LZ,

    I hope you are doing great today. Thank you for your patience and sorry for the inconvenience that this may have caused. I have finally found the issue and prepared the code below to make the layout for custom post type visible.

    This is not a bug as I initially suspected but it seems the post type of 'product' is hidden on purpose because it is usually associated with eCommerce plugins like MarketPress or WooCommerce. So if such plugin is not active then the layout for the 'single-product' is hidden from the list if there is no associated eCommerce solution.

    The good news is that the developer has put in place a filter that can be used to reveal the layout for the 'product' post type if it is required, like in your specific case. We can hook to the filter:

    add_filter('upfront-builder_skip_exported_layouts', 'call_back_function');

    Where call_back_function is a function that returns false to reveal the layout or true to hide it. I have prepared the code below which you can place in your theme's functions.php or create a new .php file, add the php opening tag, paste the code below then save and upload the file to your website in the folder 'wp-content/mu-plugins'

    Here is the code:

    add_filter('upfront-builder_skip_exported_layouts', 'ufb_unhide_product_cpt', 999, 2 );
    function ufb_unhide_product_cpt($default, $layout){
    	$item = explode('-', $layout['item'] );
    	$post_type = $item[1];
    
    	if ( post_type_exists ( $post_type ) && $post_type == 'product' ) {
    		return false;
    	}
    }

    I have tested this code on my setup, it works great if only we want to reveal the layout for the 'product' post type. Otherwise, if you want to reveal all hidden post types you only need to change the if condition from:

    if ( post_type_exists ( $post_type ) && $post_type == 'product' ) {
    		return false;
    }

    To

    if ( post_type_exists ( $post_type )) {
    		return false;
    }

    I hope this helps, please do not hesitate to contact us should you have any further queries or concerns regarding this.

    Have a nice day.
    Mahlamusa