Site logo

[Resolved] Console Error on CPT when I use these Snippets

Home Forums Support [Resolved] Console Error on CPT when I use these Snippets

Home Forums Support Console Error on CPT when I use these Snippets

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1809361
    melvin

    Hi,

    I’ve use these 2 Codes to activate MY CPT Archive layout following GP blog in customizer

    
    
    	// Project CPT, Project Tax - Content Column Setting
    	add_filter( 'generate_blog_get_column_count','ke_column_count_project_archive' );
    	function ke_column_count_project_archive( $count ) {
    		if ( is_post_type_archive('projects') || is_tax( array( 'project_status', 'project_region', 'project_type', )) ) {
    			return 50;
    		}
    
    		return $count;
    	};
    
    	// Project CPT, Project Tax - activate masonry (if not column not working)
    	add_filter( 'generate_blog_masonry','ke_projects_masonry_project_archive' );
    	function ke_projects_masonry_project_archive( $masonry ) {
    		if ( is_post_type_archive( 'projects' ) || is_tax( array( 'project_status', 'project_region', 'project_type' ) ) ) {
    			return 'true';
    		}
    
    		return $masonry;
    	};
    

    After implementation of code, it comes with a console error as this https://imgur.com/a/L3bVNaJ

    May i know how to fix it?

    Thanks

    #1809818
    David
    Staff
    Customer Support

    Hi there,

    in the Block Element do you have the Keep default post container enabled ?

    #1810067
    melvin

    Hi David,

    I’ve NOT enable Keep default post container. https://imgur.com/a/qHruRUl

    I’ve tried to enable it and then disabled it. Both test also comes with the console error message as mentioned.

    P/S: I’ve updated the code in the first post above.

    Kindly assist David.

    Thanks

    #1811153
    David
    Staff
    Customer Support

    I have been trying to replicate the problem locally but have not been able to.
    I just checked your original URL … and it looks like you chosen a different layout. Let me know.

    #1811544
    melvin

    and it looks like you chosen a different layout

    May I Know whats that mean David?

    #1811777
    David
    Staff
    Customer Support

    Although the code still works – it looks like a bug in the script. We’ll get this patched asap, but for the time being you should be able to ignore the error.

    #1811920
    melvin

    Hi David,

    Thanks for the feedback. So after you get this patched on next theme update the error will be gone right?

    #1812109
    David
    Staff
    Customer Support

    Thats correct.

    #1812117
    melvin

    Perfect

    Thanks David 😁

    #1812130
    David
    Staff
    Customer Support

    Thanks for letting us know!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.