I am trying to implement the php-markdown class in a Wordpress theme.
I am wondering if I am going about this the right way. I have put the Michelf
folder into themeroot/_/inc/php/
and in my header.php
I have the following:
<?php
set_include_path(get_include_path().PATH_SEPARATOR.get_template_directory().'/_/inc/php');
spl_autoload_register(function($class){
require preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
});
use \Michelf\Markdown;
?>
Then I am trying to use it like so:
<?php echo Markdown::defaultTransform($someText); ?>
Which results in the error:
Fatal error: Class 'Markdown' not found in /directories/.../index.php on line 11
It works if I do the following:
<?php echo Michelf\Markdown::defaultTransform($someText); ?>
Which is odd because the readme itself doesn't require the Michelf
?
Just wondering if I am going about including this class the wrong way?