Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Added excerpt for indexable posts (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromcp90 authored Apr 4, 2022
1 parent 67110de commit c3c4ce1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
21 changes: 17 additions & 4 deletions doofinder/doofinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Doofinder
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Version: 0.4.7
* Version: 0.4.8
* Author: Doofinder
* Description: Integrate Doofinder Search in your WordPress website.
*
Expand All @@ -30,7 +30,7 @@ class Doofinder_For_WordPress {
*
* @var string
*/
public static $version = '0.4.7';
public static $version = '0.4.8';

/**
* The only instance of Doofinder_For_WordPress
Expand Down Expand Up @@ -113,10 +113,12 @@ public function __construct() {
JS_Layer::instance();
Internal_Search::instance();
}

// Register all custom URLs

add_action( 'init', function () use ( $class ) {
// Register all custom URLs
call_user_func( array( $class, 'register_urls' ) );
// Enable excerpt for indexable posts
call_user_func( array( $class, 'enable_excerpt' ) );
} );
}

Expand Down Expand Up @@ -277,6 +279,17 @@ public static function upgrader_process_complete( $upgrader_object, $options ) {
}
}
}
/**
* This function enables the excerpt for any indexable post.
*/
public static function enable_excerpt(){
$post_types = Post_Types::instance();
foreach ($post_types->get_indexable() as $key => $post_type) {
if (!post_type_supports($post_type, 'excerpt')) {
add_post_type_support($post_type, 'excerpt');
}
}
}
}

endif;
Expand Down
5 changes: 4 additions & 1 deletion doofinder/readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== Doofinder ===
Contributors: doofinder, chopchoporg
Tags: search, autocomplete
Version: 0.4.7
Version: 0.4.8
Requires at least: 4.1
Tested up to: 5.9
Stable tag: trunk
Expand Down Expand Up @@ -114,6 +114,9 @@ Just send your questions to <mailto:[email protected]> and we will try to an

== Changelog ==

= 0.4.8 =
- Add excerpt field for any indexable post types.

= 0.4.7 =
- Fix indexation problems while replacing the temp index.

Expand Down

0 comments on commit c3c4ce1

Please sign in to comment.