11<?php
22class Latest_Posts_Hover_Widget extends \Elementor \Widget_Base
33{
4-
4+
55 public function __construct ($ data = [], $ args = null )
66 {
77 parent ::__construct ($ data , $ args );
@@ -86,15 +86,17 @@ protected function _register_controls()
8686 ],
8787 ]
8888 );
89+
8990 $ this ->add_control (
9091 'selected_page ' ,
9192 [
92- 'label ' => esc_html__ ('Select Page if you have a page with all post, made with this widget ' , 'OpenWidget ' ),
93+ 'label ' => esc_html__ (' Select Page if you have a page with all post, made with this widget for the links ' , 'OpenWidget ' ),
9394 'type ' => \Elementor \Controls_Manager::SELECT ,
9495 'options ' => $ this ->get_pages (),
95- 'default ' => ' 0 ' ,
96+ 'default ' => 0 ,
9697 ]
9798 );
99+
98100 $ this ->end_controls_section ();
99101 $ this ->start_controls_section (
100102 'section_title ' ,
@@ -594,7 +596,7 @@ protected function _register_controls()
594596 '{{WRAPPER}} .category-filter-button ' => 'font-family: {{VALUE}} ' ,
595597 ],
596598 ]
597- );
599+ );
598600 $ this ->add_control (
599601 'background_color_inactive ' ,
600602 [
@@ -661,7 +663,7 @@ protected function _register_controls()
661663 '{{WRAPPER}} .category-filter-button.active ' => 'font-family: {{VALUE}} ' ,
662664 ],
663665 ]
664- );
666+ );
665667 $ this ->add_control (
666668 'background_color_active ' ,
667669 [
@@ -672,7 +674,7 @@ protected function _register_controls()
672674 '{{WRAPPER}} .category-filter-button.active ' => ' background-color: {{VALUE}}; ' ,
673675 ],
674676 ]
675- );
677+ );
676678 $ this ->add_control (
677679 'active_font_size ' ,
678680 [
@@ -728,7 +730,7 @@ protected function _register_controls()
728730 '{{WRAPPER}} .category-filter-button:hover ' => 'font-family: {{VALUE}} ' ,
729731 ],
730732 ]
731- );
733+ );
732734 $ this ->add_control (
733735 'background_color_hover ' ,
734736 [
@@ -740,7 +742,7 @@ protected function _register_controls()
740742 ],
741743 ]
742744 );
743-
745+
744746 $ this ->add_control (
745747 'hover_font_size ' ,
746748 [
@@ -775,7 +777,7 @@ protected function _register_controls()
775777 ],
776778 ]
777779 );
778-
780+
779781 $ this ->end_controls_section ();
780782 }
781783 private function get_pages ()
@@ -789,7 +791,7 @@ private function get_pages()
789791 return $ options ;
790792 }
791793 protected function render ()
792-
794+
793795 {
794796 $ settings = $ this ->get_settings_for_display ();
795797 if ($ settings ['posts_per_page ' ] == null ) {
@@ -814,7 +816,9 @@ protected function render()
814816 $ args = [
815817 'posts_per_page ' => -1 ,
816818 ];
819+ $ this ->set_settings ('selected_page ' , get_the_ID ());
817820 }
821+ echo get_the_ID ();
818822
819823 $ posts = get_posts ($ args );
820824 $ cardColor = $ settings ['card_color ' ];
@@ -950,9 +954,10 @@ protected function render()
950954 echo '<div class="error-message"> ' ;
951955 echo esc_html__ ('Impossibile recuperare i post. Si è verificato un errore. ' , 'Latest-Posts-Hover ' );
952956 echo '</div> ' ;
953- } if ( isset ($ _GET ['action ' ]) && $ _GET ['action ' ] === 'edit ' ){
954- echo 'prova ' ;
955- }
957+ }
958+ if (isset ($ _GET ['action ' ]) && $ _GET ['action ' ] === 'edit ' ) {
959+ echo 'prova ' ;
960+ }
956961 echo '<style>
957962 .category-filter {
958963 display: none;
@@ -1111,8 +1116,5 @@ protected function render()
11111116 }
11121117
11131118 </style> ' ;
1114-
11151119 }
1116-
1117-
1118- }
1120+ }
0 commit comments