@@ -754,6 +754,17 @@ protected function _register_controls()
754754 ],
755755 ]
756756 );
757+ $ this ->add_control (
758+ 'remove_title ' ,
759+ [
760+ 'label ' => esc_html__ ('Remove title ' , 'Latest-Posts-Hover ' ),
761+ 'type ' => \Elementor \Controls_Manager::SWITCHER ,
762+ 'label_on ' => esc_html__ ('On ' , 'Latest-Posts-Hover ' ),
763+ 'label_off ' => esc_html__ ('Off ' , 'Latest-Posts-Hover ' ),
764+ 'return_value ' => 'on ' ,
765+ 'default ' => 'off ' ,
766+ ]
767+ );
757768 $ this ->add_control (
758769 'content_alignment ' ,
759770 [
@@ -1318,10 +1329,27 @@ protected function render()
13181329 foreach ($ posts as $ post ) {
13191330 $ post_title = get_the_title ($ post ->ID );
13201331 if (wp_is_mobile ()) {
1321- $ post_content = wp_trim_words ($ post ->post_content , $ wordMobile );
1332+ if ($ settings ['remove_title ' ]=='on ' ){
1333+ $ post_content = str_replace ($ post_title , '' , $ post ->post_content );
1334+ $ post_content = wp_trim_words ($ post_content , $ wordMobile );
1335+
1336+ }
1337+ if ($ settings ['remove_title ' ]!='on ' ){
1338+
1339+ $ post_content = wp_trim_words ($ post ->post_content , $ wordPc );
1340+ }
13221341 } else {
1342+ if ($ settings ['remove_title ' ]=='on ' ){
1343+ $ post_content = str_replace ($ post_title , '' , $ post ->post_content );
1344+ $ post_content = wp_trim_words ($ post_content , $ wordPc );
1345+
1346+ }
1347+ if ($ settings ['remove_title ' ]!='on ' ){
13231348 $ post_content = wp_trim_words ($ post ->post_content , $ wordPc );
1324- }
1349+ } }
1350+ if ($ settings ['remove_title ' ]=='on ' ){
1351+ $ post_content = str_replace ($ post_title , '' , $ post_content );
1352+ }
13251353 $ post_date = get_the_date ('j F Y ' , $ post ->ID );
13261354 $ post_link = get_permalink ($ post ->ID );
13271355 $ tags = get_the_tags ($ post ->ID );
0 commit comments