Reputation: 389
could anyone explain, is it possible include WP functions into Laravel blade.template?
I have WP installation and want create one folder for an app on Laravel. These functions i want include:
<?php require( '../wp-load.php' ); ?>
<?php get_header(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
How i can implement this feature? Thx in advance!
Upvotes: 0
Views: 1574
Reputation: 10394
app/vendor
Download WordPress into the vendor folder (./vendor/wordpress
)
User require
in composer.json, see (3).
Check the Codex page for the function you need, let's say esc_url(), as you can see in that page, the function resides in wp-includes/formatting.php
Include that file, use your composer.json
file then run the command composer update
"require": {
...
"johnpbloch/wordpress": "4.*"
},
"autoload": {
...
...
...
"files": [
...
"wordpress/wp-includes/formatting.php"
]
},
{{-- file: app/views/example.blade.php }}
{{ esc_html( '<a href="http://www.example.com/">A link</a>' ) }}
This outputs:
<a href="http://www.example.com/">A link</a>
Upvotes: 3