| @@ -106,13 +106,16 @@ | ||
| 106 | 106 | public function wrapper_attributes( $attributes, $document ) { |
| 107 | 107 | $post_type = get_post_type($document->get_main_id()); |
| 108 | 108 | |
| 109 | 109 | if( $post_type === 'templately_library' ){ |
| 110 | - $template = templately()->theme_builder->get_template( $document->get_main_id() ); | |
| 111 | - $attributes['data-elementor-type'] = 'templately-' . $template->get_type(); | |
| 112 | - $attributes['data-elementor-id'] = $template->get_main_id(); | |
| 113 | - $attributes['data-elementor-post-type'] = 'templately_library'; | |
| 114 | - $attributes['data-elementor-title'] = $template->get_title(); | |
| 110 | + $template = templately()->theme_builder->get_template( $document->get_main_id() ); | |
| 111 | + if($template){ | |
| 112 | + $attributes['data-elementor-type'] = 'templately-' . $template->get_type(); | |
| 113 | + $attributes['data-elementor-id'] = $template->get_main_id(); | |
| 114 | + $attributes['data-elementor-post-type'] = 'templately_library'; | |
| 115 | + $attributes['data-elementor-title'] = $template->get_title(); | |
| 116 | + $attributes['class'] .= ' ' . implode( ' ', get_post_class() ); | |
| 117 | + } | |
| 115 | 118 | } |
| 116 | 119 | |
| 117 | 120 | return $attributes; |
| 118 | 121 | } |