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

Commit

Permalink
Merge pull request #35 from doofinder/Sofia/add_portfolio_categories
Browse files Browse the repository at this point in the history
add portfolio categories to the feed indexation
  • Loading branch information
sofia-doofinder authored May 11, 2022
2 parents c3c4ce1 + 9258175 commit d1f7759
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 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.8
* Version: 0.4.9
* 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.8';
public static $version = '0.4.9';

/**
* The only instance of Doofinder_For_WordPress
Expand Down
12 changes: 9 additions & 3 deletions doofinder/includes/class-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public function format_for_api() {
}

// Add categories.
if ( Settings::get_index_categories() ) {
if ( Settings::get_index_categories() ) {
$data['categories'] = $this->get_categories();
}

Expand All @@ -347,8 +347,14 @@ public function format_for_api() {
* @return string[]
*/
private function get_categories() {
$all_categories = get_categories();
$post_categories = wp_get_post_categories( $this->post->ID, array( 'fields' => 'all' ) );
$all_categories = get_categories();
$post_categories = wp_get_post_categories($this->post->ID, array('fields' => 'all'));

if(taxonomy_exists("portfolio_category")){
$all_categories = array_merge($all_categories, get_terms('portfolio_category'));
$post_categories = array_merge($post_categories, wp_get_object_terms($this->post->ID, 'portfolio_category', array('fields' => 'all')));
}

$formatted_categories = array();

// We have categories as a regular array. Remap to associative
Expand Down
4 changes: 3 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.8
Version: 0.4.9
Requires at least: 4.1
Tested up to: 5.9
Stable tag: trunk
Expand Down Expand Up @@ -113,6 +113,8 @@ Just send your questions to <mailto:support@doofinder.com> and we will try to an


== Changelog ==
= 0.4.9 =
- Added portfolio_categories to the feed indexation

= 0.4.8 =
- Add excerpt field for any indexable post types.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "doofinder-wordpress",
"version": "0.4.7",
"version": "0.4.9",
"description": "Integrate Doofinder in your WordPress site with (almost) no effort.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit d1f7759

Please sign in to comment.