fullsiteediting icon indicating copy to clipboard operation
fullsiteediting copied to clipboard

Menu links got trimmed (removed)

Open rrjanbiah opened this issue 3 years ago • 9 comments

Themes created using the https://fullsiteediting.com/block-theme-generator/ are trimming the menu links. Looks like there are some limits are indirect trimming based on the length or so (But, unfortunately I couldn't yet figure it out). Strangely, when we switch to other themes like twentytwentytwo, all links are appearing in the menu.

rrjanbiah avatar Jun 02 '22 17:06 rrjanbiah

I kinda figured it out:

You'll need something like below:

<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"3rem","right":"3rem","bottom":"3rem","left":"3rem"}}},"layout":{"inherit":true}} -->
<div class="wp-block-group alignfull" style="padding-top:3rem;padding-right:3rem;padding-bottom:3rem;padding-left:3rem">
	<!-- wp:group {"align":"full", "layout":{"type":"flex","justifyContent":"space-between"}} -->
	<div class="wp-block-group alignfull">
		<!-- wp:group {"layout":{"type":"flex"}} -->
		<div class="wp-block-group">
			<!-- wp:site-logo {"width":190,"shouldSyncIcon":true} /-->

			<!-- wp:site-title {"className":"hidden","fontSize":"medium"} /-->
		</div>
		<!-- /wp:group -->

		<!-- wp:navigation {"overlayBackgroundColor":"background","overlayTextColor":"foreground","style":{"typography":{"textDecoration":"underline"}}} -->
		<!-- wp:page-list {"__unstableMaxPages":"6", "isNavigationChild":true,"showSubmenuIcon":true,"openSubmenusOnClick":false} /-->
		<!-- /wp:navigation -->
	</div>
	<!-- /wp:group -->
</div>
<!-- /wp:group -->

This addresses

  1. Full width for the header (by default, it is missing for the second group)
  2. Hidden site title (not removed for accessibility)
  3. __unstableMaxPages along with wp:page-list

rrjanbiah avatar Jun 04 '22 09:06 rrjanbiah

Hi I did not understand what you meant with "trimming the links", can you share a screenshot? Which theme versions? They do not all use the same header files and the advanced version has two header template parts.

carolinan avatar Jun 07 '22 14:06 carolinan

The pagelist should only be placed inside a navigation block in markup if it is intended to be used as the default, which is not the scenario in these example themes.

You need to set up your own menu on the sites, that is why the navigation block is empty in the markup.

carolinan avatar Jun 07 '22 15:06 carolinan

I need to check again and will share more details. But, for a quick note/reply....

When the wp:navigation is empty, by default WordPress core is populating it with wp:page-list with __unstableMaxPages: 4 (4 is hardcoded and so other links are not visible)

rrjanbiah avatar Jun 07 '22 16:06 rrjanbiah

Also, note that it addresses the full width issue (markup was wrong)

rrjanbiah avatar Jun 07 '22 16:06 rrjanbiah

Hi, I am still struggling to understand which theme version you are working with, can you give me any more information so that I can try to reproduce the alignment issue?

The number of pages in the menu is arbitrary, - you will always need to adjust the menu for your website. -If I set the number to 6, then someone with 8 pages still wont see all their pages . And so on :)

carolinan avatar Jun 18 '22 02:06 carolinan

@carolinan

I believe it is https://github.com/carolinan/fullsiteediting/blob/course/Starter%20themes/basic-60/parts/header.html#L11

Related core code https://github.com/WordPress/WordPress/blob/96c26acafd80a5da472e8bbbf41bf6a197ba8c6f/wp-includes/blocks/navigation.php#L316

So, when you install this theme.. without doing anything you'll find the menu (through fallback approach in the core code), but it will have only 4 items.

rrjanbiah avatar Jun 21 '22 03:06 rrjanbiah

Correct, if you want a customized menu with more items you need to update it and add the items you want in the menu..

carolinan avatar Jul 02 '22 09:07 carolinan

It seems to me that you didn't use the theme like I did (Just download and use). So, feel free to close the issue if required.

rrjanbiah avatar Jul 02 '22 18:07 rrjanbiah