Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register footer menus as theme locations #2506

Closed
wants to merge 3 commits into from

Conversation

stduerre
Copy link
Contributor

Summary

Register footer menus so they are available as positions in WordPress admin.

Currently, the menus in the footer (Footer Primary, Footer Secondary, Social) are only defined by naming convention. That doesn't work for multilingual setups because menu names are unique and menus that work with the master theme can not be created in more than one language at a time. Registering the menu as theme locations enabled the use of WordPress admin to select what menus to show in the footer, independent of menu names.

If no menu is set for the location, the old naming convention is still in use to ensure backwards compatibility.

Testing

  1. Make sure existing menus are still shown in the footer after installing this update (backwards compatibility)
  2. Create or edit menus and assign them to the appropriate theme locations
  3. Make sure the menus display correctly

Register footer menus so they are available as theme locations in WordPress admin.
@stduerre stduerre marked this pull request as ready for review January 20, 2025 14:58
Copy link
Contributor

@Osong-Michael Osong-Michael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I have tested on a few sites locally and have not had any issues.

src/MasterSite.php Outdated Show resolved Hide resolved
@comzeradd
Copy link
Member

@stduerre can you do some minor syntax fixes to make phpcs happy? The else statement should be on the same line as the previous closing bracket.

if (condition) {
  do someting
} else {
  do something else
}

@stduerre stduerre force-pushed the register-footer-menus branch from 79b5f1e to 5dfb3ab Compare January 27, 2025 07:40
@comzeradd
Copy link
Member

Thanks! Merged at 8c4f0dc

@comzeradd comzeradd closed this Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants