Skip to content

chore: move the site editor and code snippet state into the theme - #13

Open
YvesCesar wants to merge 9 commits into
mainfrom
chore/theme-state-in-files
Open

YvesCesar wants to merge 9 commits into
mainfrom
chore/theme-state-in-files

Conversation

@YvesCesar

@YvesCesar YvesCesar commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Part of what the theme shows was saved in the database instead of in this repository: the Global Styles, five templates edited in the Site Editor, and three Code Snippets. On a fresh install, such as CI or a test environment, the theme rendered without the brand colors, with a different header, and with an empty footer, because parts/footer.html points to a libresign/footer pattern that does not exist. This moves that state into the theme, so activating it is enough to get the same site.

Changes

  • Global Styles into theme.json: the three brand colors (custom-brand-1 to custom-brand-3, same slugs so every var(--wp--preset--color--custom-brand-*) keeps working), the button background, the heading color and weight, the navigation link weight, and the 1024px content width. The Global Styles also replaced the theme font list with one without Cardo, which left the heading font undefined and made headings inherit their font; Cardo is removed from theme.json, and the heading element, the quote and pullquote styles and five patterns no longer ask for the heading font, which keeps that inheritance. The Cardo files stay, the style variations use them.
  • Templates into files: parts/header.html, parts/footer.html, templates/archive-product.html, templates/single-product.html and templates/coming-soon.html now hold what the Site Editor had saved. The header menu pointed to a wp_navigation post by id (ref: 57); its links are now inside the navigation block. Three things that came with the saved copies are corrected on the way:
    • The header had a TranslatePress language switcher block. The site uses Polylang, the block is not registered and rendered nothing, so it is removed.
    • The saved copies replaced the WooCommerce "no results" pattern and the "Related products" heading with English text. The catalog uses the WooCommerce pattern again, and the related products block moved to a theme pattern (libresign/related-products) with the same markup and the heading through esc_html_e( 'Related products', 'woocommerce' ), so pt_BR shows "Produtos relacionados". The WooCommerce related products pattern was not used because it renders a different layout.
    • The "coming soon" page had the WooCommerce sample social links (the LinkedIn, Instagram and Facebook home pages). It now links to the LibreSign LinkedIn and Instagram profiles, the ones in the footer.
  • Code Snippets into the theme: "Bootstrap 5" (grid only) and "LineIcons CDN" are enqueued by inc/assets.php with the same handles, and the CSS of "Header and footer styling" is assets/css/header-footer.css. The header and footer fragments from the static site use the Bootstrap grid and the ud-* classes, so they are still needed. With the same handles, a site where the snippets are still active does not load them twice.
  • Policy link: the terms checkbox and the registration form linked to the page with id 3, which is the unpublished WordPress privacy template, so the link returned 404, and the fallback /privacy-police/ also returns 404. They now link to https://libresign.coop/privacy-policy, the policy the footer and the static site link to.

After deploy

Until the database copies are removed, they keep taking precedence and the site looks the same. To make the theme the only source:

  1. Appearance > Editor > Styles > Reset to defaults.
  2. Appearance > Editor > Patterns/Templates: "Clear customizations" on header, footer, Product Catalog, Single Product and Page: Coming soon.
  3. Deactivate the "Bootstrap 5", "LineIcons CDN" and "Header and footer styling" snippets.

Verification

Full-page screenshots of the home, /lost-password/, the store, the cart, two product pages and a 404, as guest and as admin, at 1280px and 390px wide (28 screenshots), compared pixel by pixel:

  • This branch with the database copies still in place (the state right after deploy) against main: all 28 are identical, and Bootstrap, LineIcons and the header and footer CSS load once.
  • This branch with the database copies removed against main with them: identical with and without the synced header and footer fragments, except the WooCommerce "coming soon" page shown to guests: the Facebook icon is gone, and the heading font changed. WooCommerce registers the Cardo font for that page only when the theme does not declare a font named Cardo; the theme declared it without using it, so the page fell back to a generic serif. It now renders in Cardo, as the WooCommerce template intends.
  • composer ci passes.

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
…de snippets

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
@YvesCesar
YvesCesar marked this pull request as draft September 28, 2026 15:53
…ares

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Base automatically changed from chore/static-analysis to main September 29, 2026 15:19
@YvesCesar
YvesCesar marked this pull request as ready for review September 29, 2026 20:40
<!-- wp:post-template {"className":"products-block-post-template","layout":{"type":"grid","columnCount":5},"__woocommerceNamespace":"woocommerce/product-query/product-template"} -->
<!-- wp:woocommerce/product-image {"isDescendentOfQueryLoop":true} /-->

<!-- wp:post-title {"textAlign":"center","level":3,"fontSize":"medium","__woocommerceNamespace":"woocommerce/product-query/product-title"} /-->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The related product title is not clickable here because core/post-title does not have isLink: true.

Could we keep the product title linked, as we already do in the product catalog?

Suggested change
<!-- wp:post-title {"textAlign":"center","level":3,"fontSize":"medium","__woocommerceNamespace":"woocommerce/product-query/product-title"} /-->
<!-- wp:post-title {"textAlign":"center","level":3,"isLink":true,"fontSize":"medium","__woocommerceNamespace":"woocommerce/product-query/product-title"} /-->

<main class="wp-block-group">
<!-- wp:woocommerce/breadcrumbs /-->
<!-- wp:woocommerce/store-notices /-->
<main class="wp-block-group"><!-- wp:woocommerce/store-notices /-->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why does we removed the indent here?

Comment thread inc/assets.php
Comment on lines +26 to +27
wp_enqueue_style( 'bootstrap-css', 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap-grid.min.css', array(), '5.3.0' );
wp_enqueue_style( 'lineicons', 'https://cdn.lineicons.com/4.0/lineicons.css', array(), null );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we remove the CDN dependency here and manage these packages through package.json instead?

This would make the frontend dependencies versioned and reproducible, without relying on external CDNs at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants