bhadaway / blankslate

A naked WordPress theme, powering over 10k websites. Buy me a sandwich. 🥪
https://opencollective.com/blankslate
325 stars 92 forks source link

menu doesn't seem to be registered in my child theme after updating the blankslate theme to the 2021 version #27

Closed sabbbi closed 2 years ago

sabbbi commented 3 years ago

Does anybody know how I can fix this?

bhadaway commented 3 years ago

Did you at any point edit the parent theme itself? If so, those changes would have been overwritten.

As for the menu, do you mean just the default main menu, or have you also added your own custom menu? Would you be able to share your header.php code, or whatever file is relevant?

I'll take a look.

sabbbi commented 3 years ago

I've hidden a specific class in a .css file of the main theme. The main theme has been updated but in both the updated one and the older one I get the same "menu is not existing" message.

I have not added my own custom menu, here is the code of the header.php file: Thanks a lot in advance, much appreciated!

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="wrapper" class="hfeed">
<header id="header">

<div id="branding">
<div id="site-title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="logo-wildekeuze"></a>
</div>

<div id="site-description"><?php bloginfo( 'description' ); ?></div>
</div>

<nav id="menu">
<div id="search"><?php get_search_form(); ?></div>
<?php wp_nav_menu( array( 'theme_location' => 'main-menu' ) ); ?>
</nav>

</header>
<div id="container">
bhadaway commented 3 years ago

Okay, so what you need to do is add your custom header.php alterations to the child theme only (all you have to do is copy header.php from the parent theme and paste it into the child theme and then edit as you like). Anything that was written into the main theme is now gone.

sabbbi commented 3 years ago

I did exactly as you said and the message still appears and I cannot alter the menu. I will share a screenshot of the page, in the top the message says (translated from Dutch): "Your theme does not support menus, but you can use them in the sidebars by adding a “Custom Menu” widget on the Widgets screen."

Schermafbeelding 2021-08-01 om 11 55 42

Code example of the updated header.php file within the child theme:

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div id="wrapper" class="hfeed">
<header id="header" role="banner">
<div id="branding">
<div id="site-title" itemprop="publisher" itemscope itemtype="https://schema.org/Organization">
<?php
if ( is_front_page() || is_home() || is_front_page() && is_home() ) { echo '<h1>'; }
echo '<a href="' . esc_url( home_url( '/' ) ) . '" title="' . esc_attr( get_bloginfo( 'name' ) ) . '" rel="home" itemprop="url"><span itemprop="name" class="hidden">' . esc_html( get_bloginfo( 'name' ) ) . '</span><div class="logo-wildekeuze"></div></a>';
if ( is_front_page() || is_home() || is_front_page() && is_home() ) { echo '</h1>'; }
?>
</div>
<div id="site-description"<?php if ( !is_single() ) { echo ' itemprop="description"'; } ?>><?php bloginfo( 'description' ); ?></div>
</div>
<nav id="menu" role="navigation" itemscope itemtype="https://schema.org/SiteNavigationElement">
<?php wp_nav_menu( array( 'theme_location' => 'main-menu', 'link_before' => '<span itemprop="name">', 'link_after' => '</span>' ) ); ?>
<div id="search"><?php get_search_form(); ?></div>
</nav>
</header>
<div id="container">

Are there any other files that I can share with you that might be of any help?

bhadaway commented 3 years ago

At this point, I'll just need to review the entirety of both your parent theme and child theme.

Can you please zip up the two theme folders and send them to me at bhadaway@gmail.com.

An easy tool to send files securely: https://wormhole.app/

sabbbi commented 3 years ago

I've send you the folders!

bhadaway commented 3 years ago

After reviewing your code, here are my findings:

  1. There are no issues with your parent theme, so we can check that off.
  2. In your child theme, there's no need copy over ALL files from the parent theme, and this will likely cause problems, if it's not already. There's no need to copy over a template unless you intend on making a customization to it.
  3. I wouldn't recommend storing backup files directly within your child theme and store those elsewhere (ARCHIVED header.php and Header.php backup.rtf).
  4. Your child functions.php has all the menu registration hooks commented out. I think this is the main issue.
sabbbi commented 3 years ago

Hi Bryan!

Thanks for your reply. I just got back from a holiday so excuse me for my late reply. Hopefully your hints will help me.

Best,

Sabrina

Op zo 1 aug. 2021 om 13:03 schreef Bryan Hadaway @.***>:

After reviewing your code, here are my findings:

  1. There are no issues with your parent theme, so we can check that off.
  2. In your child theme, there's no need copy over ALL files from the parent theme, and this will likely cause problems, if it's not already. There's no need to copy over a template unless you intend on making a customization to it.
  3. I wouldn't recommend storing backup files directly within your child theme and store those elsewhere (ARCHIVED header.php and Header.php backup.rtf).
  4. Your child functions.php has all the menu registration hooks commented out. I think this is the main issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tidythemes/blankslate/issues/27#issuecomment-890497307, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA74NCMJ5UGTGFVRJ43YEATT2USY5ANCNFSM5BI6S7JA .