Skip to content

Commit 24b7aaa

Browse files
committed
excerpt
1 parent 7c32edc commit 24b7aaa

2 files changed

Lines changed: 27 additions & 7 deletions

File tree

Open-Elementor-Widget.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ function dequeue_parent_theme_styles() {
1414
wp_dequeue_style( 'parent-style-rtl' );
1515
}
1616
}
17+
function my_custom_excerpt() {
18+
$content=get_the_content();
19+
$excerpt=wp_trim_words( $content, 30 );
20+
return $excerpt;
21+
22+
}
23+
24+
add_filter( 'get_the_excerpt', 'my_custom_excerpt' );
1725
add_action('elementor/widgets/widgets_registered', 'register_OpenElementorWidget_widgets');
1826

1927
function add_elementor_widget_categories($elements_manager)

widgets/Latest-Posts-Hover.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -794,8 +794,19 @@ private function get_pages()
794794
}
795795
protected function render()
796796

797-
{
798-
$settings = $this->get_settings_for_display();
797+
{
798+
$settings = $this->get_settings_for_display();
799+
800+
if(isset($_GET['s']) || is_archive()){
801+
if($settings['all_post']!='all'){
802+
echo 'latest '.$settings['posts_per_page']."post";
803+
}
804+
else{
805+
echo 'latest post';
806+
}
807+
}
808+
else{
809+
799810
if ($settings['posts_per_page'] == null) {
800811
$settings['posts_per_page'] = 4;
801812
}
@@ -881,7 +892,7 @@ protected function render()
881892
echo '<div class="categories-links">';
882893
foreach ($categories as $category) {
883894
$category_link = add_query_arg('category', $category->slug, $page_link);
884-
echo '<a href="' . $category_link . '" class="category">' . $category->name . '</a>';
895+
echo '<a href="' . $category_link . '" class="category"> ' . $category->name . ' </a>';
885896
}
886897
echo '</div>';
887898
}
@@ -890,7 +901,7 @@ protected function render()
890901
if (!empty($categories)) {
891902
echo '<div class="categories-links">';
892903
foreach ($categories as $category) {
893-
echo '<a href="' . get_category_link($category->term_id) . '" class="category">' . $category->name . '</a>';
904+
echo '<a href="' . get_category_link($category->term_id) . '" class="category"> ' . $category->name . ' </a>';
894905
}
895906
echo '</div>';
896907
}
@@ -913,7 +924,7 @@ protected function render()
913924
// If not, use the custom default image
914925
$featured_image = $settings['default_image']['url'];
915926
}
916-
if (iElementor\Plugin::$instance->editor->is_edit_mode()) {
927+
if (is_admin()) {
917928
echo '<div class="card2" style="background-image: url(' . $featured_image . '); ">';
918929
} else {
919930
echo ' <div class="card2" style="background-image: url(' . $featured_image . '); "onclick=\'window.location.href="' . $post_link . '"\'>';
@@ -929,7 +940,7 @@ protected function render()
929940
echo '<div class="categories-links">';
930941
foreach ($categories as $category) {
931942
$category_link = add_query_arg('category', $category->slug, $page_link);
932-
echo '<a href="' . $category_link . '" class="category">' . $category->name . '</a>';
943+
echo '<a href="' . $category_link . '" class="category"> ' . $category->name . ' </a>';
933944
}
934945
echo '</div>';
935946
}
@@ -938,7 +949,7 @@ protected function render()
938949
if (!empty($categories)) {
939950
echo '<div class="categories-links">';
940951
foreach ($categories as $category) {
941-
echo '<a href="' . get_category_link($category->term_id) . '" class="category">' . $category->name . '</a>';
952+
echo '<a href="' . get_category_link($category->term_id) . '" class="category">' . $category->name . ' </a>';
942953
}
943954
echo '</div>';
944955
}
@@ -1118,4 +1129,5 @@ protected function render()
11181129
11191130
</style>';
11201131
}
1132+
}
11211133
}

0 commit comments

Comments
 (0)