Permalink
Browse files

Add third-party pluralize method via composer

- add composer.json to include third-party library
  https://packagist.org/packages/doctrine/inflector
- add autoloader line to plugin (supported in PHP >= 5.3)
- add call to third-party pluralize method

Fixes #2
  • Loading branch information...
salcode committed May 30, 2015
1 parent dd95bae commit 7e9a193abb1ebfb7bf74d782fc47e437ebff9dbe
Showing with 9 additions and 2 deletions.
  1. +5 −0 composer.json
  2. +4 −2 pluralize-title.php
@@ -0,0 +1,5 @@
{
"require": {
"doctrine/inflector": "^1.0.0"
}
}
@@ -13,6 +13,8 @@
die;
}
$loader = require 'vendor/autoload.php';
add_filter( 'the_title', 'fe_pluralize_post_title', 15 );
/**
@@ -26,8 +28,8 @@
*/
function fe_pluralize_post_title( $title ) {
// append an 's' to make the title plural
$title .= 's';
// make the title plural
$title = Doctrine\Common\Inflector\Inflector::pluralize( $title );
return $title;
}

0 comments on commit 7e9a193

Please sign in to comment.