@@ -84,7 +84,7 @@ protected function _register_controls()
8484 'min ' => 0 ,
8585 'max ' => 1 ,
8686 'step ' => 0.1 ,
87- 'default ' => 0.8 ,
87+ 'default ' => 0.8 ,
8888 'selectors ' => [
8989 '{{WRAPPER}} .info ' => 'filter:opacity({{VALUE}})!important; ' ,
9090 ],
@@ -131,6 +131,46 @@ protected function _register_controls()
131131 ],
132132 ]
133133 );
134+ $ this ->add_control (
135+ 'height_card ' ,
136+ [
137+ 'label ' => esc_html__ ('Height card ' , 'Latest-Posts-Hover ' ),
138+ 'type ' => \Elementor \Controls_Manager::SLIDER ,
139+ 'default ' => [
140+ 'size ' => 50 ,
141+ 'unit ' => 'dvh ' ,
142+ ],
143+ 'range ' => [
144+ 'px ' => [
145+ 'min ' => 1 ,
146+ 'max ' => 100 ,
147+ ],
148+ ],
149+ 'selectors ' => [
150+ '{{WRAPPER}} .card2 ' => 'height: {{SIZE}}{{UNIT}}; ' ,
151+ ],
152+ ]
153+ );
154+ $ this ->add_control (
155+ 'content_card ' ,
156+ [
157+ 'label ' => esc_html__ ('Height card content pre animation(smaller is higher) ' , 'Latest-Posts-Hover ' ),
158+ 'type ' => \Elementor \Controls_Manager::SLIDER ,
159+ 'default ' => [
160+ 'size ' => 500 ,
161+ 'unit ' => 'px ' ,
162+ ],
163+ 'range ' => [
164+ 'px ' => [
165+ 'min ' => 1 ,
166+ 'max ' => 1000 ,
167+ ],
168+ ],
169+ 'selectors ' => [
170+ '{{WRAPPER}} .info ' => 'height: {{SIZE}}{{UNIT}}; ' ,
171+ ],
172+ ]
173+ );
134174 $ this ->end_controls_section ();
135175 $ this ->start_controls_section (
136176 'section_error ' ,
@@ -1329,7 +1369,7 @@ protected function render()
13291369 foreach ($ posts as $ post ) {
13301370 $ post_title = get_the_title ($ post ->ID );
13311371 $ dom = new DOMDocument ();
1332- libxml_use_internal_errors (true ) AND libxml_clear_errors ();
1372+ libxml_use_internal_errors (true ) and libxml_clear_errors ();
13331373 if ($ settings ['remove_title ' ] == 'on ' ) {
13341374 if (!empty ($ post ->post_content )) {
13351375 // Set the charset to UTF-8
@@ -1338,7 +1378,7 @@ protected function render()
13381378 $ dom ->substituteEntities = false ;
13391379 $ dom ->loadHTML ('<?xml encoding="UTF-8"> ' . $ post ->post_content );
13401380 $ elements = $ dom ->getElementsByTagName ('h2 ' );
1341-
1381+
13421382 // Loop through h2 elements and remove them
13431383 foreach ($ elements as $ element ) {
13441384 $ element ->parentNode ->removeChild ($ element );
@@ -1350,12 +1390,10 @@ protected function render()
13501390
13511391 if (wp_is_mobile ()) {
13521392 $ post_content = wp_trim_words ($ post ->post_content , $ wordMobile );
1353-
1354- }
1355- else {
1356-
1393+ } else {
1394+
13571395 $ post_content = wp_trim_words ($ post ->post_content , $ wordPc );
1358- }
1396+ }
13591397 $ post_date = get_the_date ('j F Y ' , $ post ->ID );
13601398 $ post_link = get_permalink ($ post ->ID );
13611399 $ tags = get_the_tags ($ post ->ID );
@@ -1367,12 +1405,12 @@ protected function render()
13671405 // If not, use the custom default image
13681406 $ featured_image = $ settings ['default_image ' ]['url ' ];
13691407 }
1370-
1371- if (wp_is_mobile () || is_admin ()) {
1372- echo '<div class="card2" style="background-image: url( ' . $ featured_image . ')" > ' ;
1373- } else {
1374- echo '<div class="card2" style="background-image: url( ' . $ featured_image . ')" onclick="window.location.href= \'' . $ post_link . '\'"> ' ;
1375- }
1408+
1409+ if (wp_is_mobile () || is_admin ()) {
1410+ echo '<div class="card2" style="background-image: url( ' . $ featured_image . ')" > ' ;
1411+ } else {
1412+ echo '<div class="card2" style="background-image: url( ' . $ featured_image . ')" onclick="window.location.href= \'' . $ post_link . '\'"> ' ;
1413+ }
13761414 echo '
13771415 <div class="info">
13781416 <a class="title" href=" ' . $ post_link . '"> ' . $ post_title . ' <a/> ' ;
@@ -1452,20 +1490,19 @@ protected function render()
14521490 echo '</div> ' ;
14531491 }
14541492 if (!$ posts ) {
1455-
1456- echo '<a class="error-message"> ' . $ settings ['error_message ' ];
1493+
1494+ echo '<a class="error-message"> ' . $ settings ['error_message ' ];
14571495 echo '</a> ' ;
1458- if ($ args ['s ' ]!= null ) {
1459- echo ' <div class="container2"> ' ;
1460- if ($ selected_page_id != 0 ) {
1461- $ page_link = get_permalink ($ selected_page_id );
1496+ if ($ args ['s ' ] != null ) {
1497+ echo ' <div class="container2"> ' ;
1498+ if ($ selected_page_id != 0 ) {
1499+ $ page_link = get_permalink ($ selected_page_id );
14621500
1463- echo ' <form id="form2" action=" ' . $ page_link . '"> ' ;
1464- }
1465- else {
1466- echo ' <form id="form2" action=""> ' ;
1467- }
1468- echo '
1501+ echo ' <form id="form2" action=" ' . $ page_link . '"> ' ;
1502+ } else {
1503+ echo ' <form id="form2" action=""> ' ;
1504+ }
1505+ echo '
14691506 <input type="text" id="input2"name="input2" class="input2" placeholder=" ' . $ place . '">
14701507 <div class="icon2">
14711508 <button type="submit" class="submit-button" value="input2">
@@ -1478,8 +1515,8 @@ protected function render()
14781515 </div>
14791516 </div>
14801517 </div> ' ;
1518+ }
14811519 }
1482- }
14831520 echo '<style>
14841521 .category-filter {
14851522 display: flex;
@@ -1536,7 +1573,8 @@ protected function render()
15361573 }
15371574 .card2 {
15381575 border-radius: 16px;
1539- margin: 0 auto;
1576+ margin-left: 0.5%;
1577+ margin-right: 0.5%;
15401578 box-shadow: 1px 3px 5px -1px rgba(0, 0, 0, 0.5),
15411579 1px 5px 8px 0px rgba(0, 0, 0, 0.14),
15421580 1px 1px 14px 0px rgba(0, 0, 0, 0.12);
@@ -1546,13 +1584,13 @@ protected function render()
15461584 background-position: center;
15471585 background-size: cover;
15481586 cursor: pointer;
1549-
1587+ height:50dvh;
15501588 }
15511589
15521590 .info {
15531591 position: relative;
15541592 width: 100%;
1555- height: 600px ;
1593+ height: 500px ;
15561594 background-color: white;
15571595 filter:opacity(0.8);
15581596 transform: translateY(100%)
@@ -1643,8 +1681,6 @@ protected function render()
16431681 .card2-container {
16441682 display: flex;
16451683 flex-wrap: wrap;
1646- justify-content: left;
1647- flex-basis: ( ' . $ flex . '- 20px);
16481684 }
16491685 }
16501686 } ' ;
@@ -1730,4 +1766,4 @@ protected function render()
17301766 }
17311767 </style> ' ;
17321768 }
1733- }
1769+ }
0 commit comments