1. Go to this page and download the library: Download webstractions/sage-xpress library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
webstractions / sage-xpress example snippets
add_action('after_setup_theme', function (){
...
/**
* Add Blade to Sage container
*/
sage()->singleton('sage.blade', function (Container $app) {
$cachePath = config('view.compiled');
if (!file_exists($cachePath)) {
wp_mkdir_p($cachePath);
}
(new BladeProvider($app))->register();
return new Blade($app['view']);
});
// Copy this part into app\setup.php after_theme_setup action.
// Make sure it follows the Sage singleton for the Blade Provider.
(new \SageXpress\SageXpress(sage()))->bootstrap();
});
sage('blade')->compiler()->directive('name', function ($expression) {
// Handle the directive.
});
Blade::directive('name', function ($expression) {
// Handle the directive.
});
if (have_posts()) :
while(have_posts()) :
the_post();
// Code inside of the loop
endwhile;
endif;