@@ -26,6 +26,7 @@ public function get_categories()
2626 {
2727 return ['OpenWidget ' ];
2828 }
29+
2930 protected function _register_controls ()
3031 {
3132 $ this ->start_controls_section (
@@ -86,7 +87,7 @@ protected function _register_controls()
8687 ],
8788 ]
8889 );
89-
90+
9091 $ this ->add_control (
9192 'selected_page ' ,
9293 [
@@ -97,7 +98,8 @@ protected function _register_controls()
9798 ]
9899 );
99100
100- $ this ->end_controls_section ();
101+ $ this ->end_controls_section ();
102+
101103 $ this ->start_controls_section (
102104 'section_title ' ,
103105 [
@@ -816,11 +818,7 @@ protected function render()
816818 $ args = [
817819 'posts_per_page ' => -1 ,
818820 ];
819- echo '<script>
820- const selectedPageControl = elementor.settings.page.controls.selected_page;
821-
822- // Imposta il valore desiderato per il controllo
823- selectedPageControl.setValue( ' . get_the_ID () . '); </script> ' ; // Sostituisci 10 con l'ID pagina desiderato
821+
824822 }
825823
826824 $ posts = get_posts ($ args );
@@ -915,7 +913,7 @@ protected function render()
915913 // If not, use the custom default image
916914 $ featured_image = $ settings ['default_image ' ]['url ' ];
917915 }
918- if (is_admin ()) {
916+ if (iElementor \Plugin:: $ instance -> editor -> is_edit_mode ()) {
919917 echo '<div class="card2" style="background-image: url( ' . $ featured_image . '); "> ' ;
920918 } else {
921919 echo ' <div class="card2" style="background-image: url( ' . $ featured_image . '); "onclick= \'window.location.href=" ' . $ post_link . '" \'> ' ;
@@ -1120,4 +1118,4 @@ protected function render()
11201118
11211119 </style> ' ;
11221120 }
1123- }
1121+ }
0 commit comments