Hi
in Sage 10 where I have to put:
- code for
<head>
(ie. meta for favicons or Google Analytics or other) - where I put classes on
<body>
tag - how to remove
<div id="app">
wrapping all? Or is it reccomended to keep it?
Thanks
Hi
in Sage 10 where I have to put:
<head>
(ie. meta for favicons or Google Analytics or other)<body>
tag<div id="app">
wrapping all? Or is it reccomended to keep it?Thanks
You can find it inside of index.php
Check the screenshot below:
@hallowichig0 Thanks!
Is a good practice modify that file?
It seems like it’s not a good thing put <meta>
and stuff directly in that file, to me, wrong?
Is there maybe a better practice?
Also I need to use a Blade directives (@asset
or @svg
for include an svg sprite) and can’t work there
Yes you can modify that file. You can also use some WordPress hook like the wp_head action to add some meta tag.
Example:
In setup.php
add_action( 'wp_head', __NAMESPACE__ . '\\your_action_hook' );
function your_action_hook() {
echo '<meta charset="' . bloginfo( 'charset' ) . '">';
}
You can also try this one.
In index.php
<?php echo \Roots\view(\Roots\app('sage.view'), \Roots\app('sage.data'))->render(); ?>
In app.blade.php
<!doctype html>
<html {!! get_language_attributes() !!}>
@include('partials.head')
<body @bodyclass>
@wpbodyopen
@action('get_header')
@include('partials.header')
<main id="primary" class="main content-area main-wrapper">
@yield('content')
</main>
@include('partials.footer')
@action('get_footer')
@wpfoot
</body>
</html>
Take note: you need to install Sage Directive via componser
See for the reference: https://log1x.github.io/sage-directives-docs/usage/wordpress.html
Thanks @hallowichig0
this one could works without Sage Directive? Using standard WP function in place of directives
Yes, you can replace the sage directives with WP function like in the Sage 9
<!doctype html>
<html {!! get_language_attributes() !!}>
@include('partials.head')
<body @php body_class() @endphp>
@php do_action('get_header') @endphp
@include('partials.header')
<main id="primary" class="main content-area main-wrapper">
@yield('content')
</main>
@include('partials.footer')
@php do_action('get_footer') @endphp
@php wp_footer() @endphp
</body>
</html>
This topic was automatically closed after 42 days. New replies are no longer allowed.