FEATURE Add utility functions for reading time calculation and taxonomy retrieval
This commit is contained in:
parent
5d17a97892
commit
065d4f11bd
28
includes/utilities.php
Normal file
28
includes/utilities.php
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonctions utilitaires pour le calcul du temps de lecture
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function calculate_reading_time($content)
|
||||||
|
{
|
||||||
|
$content = strip_tags($content);
|
||||||
|
|
||||||
|
// Compter les mots (en français, on compte environ 200 mots par minute)
|
||||||
|
$word_count = str_word_count($content);
|
||||||
|
$reading_time = ceil($word_count / 200);
|
||||||
|
|
||||||
|
return $reading_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
$tags = get_terms(array(
|
||||||
|
'taxonomy' => 'etiquettes',
|
||||||
|
'hide_empty' => false,
|
||||||
|
));
|
||||||
|
|
||||||
|
return $tags;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user