who to implement header.php with code in head in a fse block theme
-
Hello, i have not found anywhere something to this topic.
What i have found: https://fullsiteediting.com/lessons/how-to-use-php-templates-in-block-themes/But i have a custom block theme built with create block theme plugin. Everything ist fine. Now i dont want to use a SEO Plugin, because they slow down my website.
So i had installed in my hybrid theme in header.php the meta description, and a basic SEO Code – not mine, but a good code snippet – .
What i want: i want to implement this code in my fse block theme. I dont need a page.php, like this ist described in fullsiteediting.com. I only need the SEO Code snippet in the header.php.
Because i dont know how to do this in a block theme.
PHP something like this:
<?php echo '<meta name="robots" content="'; if ( is_category() ) { // Archive: Category echo 'noindex,follow'; } elseif ( is_archive() ) { // Archive: In generell echo 'noindex,follow'; } elseif ( is_search() ) { // Search echo 'noindex,follow'; } elseif ( ($paged > 1) ) { // Archive: By day echo 'noindex,follow'; } else { // Everything else. Fallback echo 'index,follow'; } echo '" />'; ?>
and the example in fullsiteediting.com is:
<?php /* Template Name: Example */ ?> <!doctype html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>"> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <?php wp_body_open(); ?> <div class="wp-site-blocks"> </div> <?php wp_footer(); ?> </body> </html>
When i put this SEO Code snippet between the head, it does not work , there ist no output in the code view in the browser. This ist not the full SEO Code, i put here only the last bit as an example.
I did the header.php in the root folder of my block theme. Perhaps this is not correct ?
Perhaps someone can help ? Thank you.
- The topic ‘who to implement header.php with code in head in a fse block theme’ is closed to new replies.