Developments

Sinag: A Free WordPress Block Theme for Philippine Small Businesses

Efraim Ray Efraim Ray 0 Comments
WordPress Theme Showcase

Many small businesses around Bukidnon finally get a website, only to end up with a heavy page-builder theme that crawls on mobile data, and a phone number typed into a dozen places that all go stale the day the number changes. I built Sinag, a free WordPress block theme that loads no theme JavaScript, comes with sections made for cafés, stores, clinics and cooperatives, and lets the owner type their phone, hours and address once.

Sinag is Filipino for ray of light. It runs on WordPress Full Site Editing with theme.json version 3, ships five colour styles, and uses the WordPress Block Bindings API so the header, footer, hero buttons and contact card all read from one Business Details screen.

Type WordPress Block Theme
Backend PHP 7.4+ / WP 6.6+
Editor Site Editor + theme.json v3
Version v1.0.0
License Free · GPL-2.0+

Try It: Restyle a Café Site in One Click

This is a sample café homepage built from Sinag's patterns. Pick a style variation, then type a new phone number and watch the top bar, the Call button and its +63 link update together.

kapehansaburol.example/
Mon–Sat 7:00 AM – 6:00 PM · Sun closed0926 555 0142
Kapehan sa BurolMenuAboutContact

Sample café · Valencia City

Locally roasted Bukidnon coffee, brewed the way you like it.

Beans from farms around Mount Kitanglad, roasted every Tuesday.

Call us+639265550142Message us

Brewed Robusta₱85

Pandesal (6 pcs)₱45

Spanish latte₱140

Beans, 250 g₱320

Style
Call linktel:+639265550142

Build Footprint & Quality Checks

Most of my clients' visitors are on mobile data, so the theme had to stay small. These are the measured numbers from the v1.0.0 build:

1.8
Theme CSS
KB gzipped
0
Theme JavaScript
no scripts enqueued
0
External Requests
system font stacks
14
PHP Files Linted
php -l: 0 errors

Technology Stack & Architecture Layers

Platform

WordPress 6.6+ Full Site Editing

Eight HTML templates, two template parts and ten PHP patterns, all editable in Appearance → Editor.

Design Tokens

JSON: theme.json v3

A seven-colour palette, fluid type and spacing scales, plus four style variations in styles/ that reuse the same slugs.

Server Logic

PHP: Settings & Block Bindings

A Business Details screen built on the Settings API, and a sinag-theme/business binding source that fills blocks at render time.

Languages

PHP 55% · JSON 21% · HTML 11%

Plus CSS 7% for the few things theme.json can't do, and JavaScript 6% for the Node test script. No build step.

Key Architectural Decisions

Pillar 01

Type It Once

Phone, email, address, hours and chat link live in one option. Paragraphs and buttons ask the binding source for them, so a new number updates every section.

Pillar 02

Slugs, Never Hex Codes

Patterns only reference base, contrast and accent. A style variation swaps seven values and the whole site follows, with WCAG contrast checked by a test script.

Pillar 03

Sanitize In, Escape Out

The Settings API adds the nonce, each field is cleaned by type, javascript: links are rejected, and the binding callback escapes every value it returns.

Pillar 04

No Scripts, No Font Files

The FAQ uses the native Details block, the hero's sun is a CSS gradient, and headings use system serif fonts. The theme itself enqueues one small stylesheet.

Binding Source, +63 Call Links & Usage

These are the pieces behind "type it once": the binding callback WordPress calls while rendering, the helper that turns local numbers into international Call links, and the block markup that uses them.

// inc/business-details.php
function sinag_theme_business_binding_value( $source_args, $block_instance, $attribute_name ) {
	unset( $block_instance );

	$key  = isset( $source_args['key'] ) ? sanitize_key( $source_args['key'] ) : '';
	$data = sinag_theme_get_business();

	switch ( $key ) {
		case 'phone_link':
			$value = sinag_theme_phone_to_tel( $data['phone'] );
			break;
		case 'email_link':
			$value = $data['email'] ? 'mailto:' . $data['email'] : '';
			break;
		default:
			$value = isset( $data[ $key ] ) ? $data[ $key ] : '';
	}

	if ( '' === $value ) {
		return null;
	}

	// URL attributes are encoded by the HTML API when written; rich-text content is inserted as HTML.
	if ( in_array( $attribute_name, array( 'url', 'href' ), true ) ) {
		return 0 === strpos( $value, 'tel:' ) || 0 === strpos( $value, 'mailto:' ) ? $value : esc_url_raw( $value );
	}

	return esc_html( $value );
}

register_block_bindings_source(
	'sinag-theme/business',
	array(
		'label'              => __( 'Business Details', 'sinag-theme' ),
		'get_value_callback' => 'sinag_theme_business_binding_value',
	)
);
// inc/helpers.php — pure PHP, unit-tested without WordPress
function sinag_theme_phone_to_tel( $phone ) {
	$phone  = trim( (string) $phone );
	$digits = preg_replace( '/\D/', '', $phone );

	if ( '' === $digits ) {
		return '';
	}

	if ( 0 === strpos( $phone, '+' ) ) {
		return 'tel:+' . $digits;
	}

	if ( 0 === strpos( $digits, '63' ) && 12 === strlen( $digits ) ) {
		return 'tel:+' . $digits;
	}

	if ( 0 === strpos( $digits, '0' ) && strlen( $digits ) >= 9 && strlen( $digits ) <= 11 ) {
		return 'tel:+63' . substr( $digits, 1 );
	}

	return 'tel:' . $digits;
}
<!-- Any paragraph can print a Business Details field -->
<!-- wp:paragraph {"metadata":{"bindings":{"content":{"source":"sinag-theme/business","args":{"key":"hours"}}}}} -->
<p>Mon–Sat 7:00 AM – 6:00 PM · Sun closed</p>
<!-- /wp:paragraph -->

<!-- A button's link can be the +63 Call link or your Messenger URL -->
<!-- wp:button {"metadata":{"bindings":{"url":{"source":"sinag-theme/business","args":{"key":"phone_link"}}}}} -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="tel:+639170000000">Call us</a></div>
<!-- /wp:button -->

// styles/dagat.json — a whole new look is seven colours with the same slugs
{ "version": 3, "title": "Dagat",
  "settings": { "color": { "palette": [
    { "slug": "base", "color": "#f3f8fb" }, { "slug": "contrast", "color": "#0b2533" },
    { "slug": "accent", "color": "#0d7fa5" }, { "slug": "on-accent", "color": "#ffffff" } ] } } }

Development Roadmap & Milestones

Version 1.0.0 is released. The next milestones come straight from the project's roadmap:

1

v1.0.0: Core Theme (Released)

Five style variations, eight templates, ten patterns, three block styles, Business Details with Block Bindings and automatic +63 Call links.

2

Next: Live Values in the Editor

Register the binding source in JavaScript too, so the Site Editor shows the real phone and hours instead of the pattern's sample text.

3

Planned: Schools, LGUs & Clinics

New variations and patterns for enrollment notices, office directories, clinic schedules and a printable menu.

4

Planned: WooCommerce Templates

Shop, product and cart templates styled from the same palette, for small stores that want to take orders online.

User Interface & Feature Showcase

Sinag
Kape
Dagat
Palay
Gabi
Site Editor

Five Styles, Same Content

Every palette passes WCAG AA, and body text passes AAA.

Appearance › Business Details
Phone0926 555 0142
HoursMon–Sat 7:00 AM – 6:00 PM · Sun closed
AddressPurok 3, Poblacion, Valencia City
Messengerhttps://m.me/kapehan.example
Save details
wp-admin

One Screen for Contact Details

Saved once, printed in the header, footer and patterns through Block Bindings.

Coffee

Brewed Bukidnon Robusta₱85

Spanish latte₱140

Tablea hot chocolate₱120

Patterns

Price Lists in Pesos

A "Price row" block style draws the dotted leaders, ready for menus and rate cards.

Project Links, Code & Documentation

Download & Live Demo

Get sinag-theme.zip and install it under Appearance → Themes → Add New → Upload Theme, or try the interactive preview first.

Open the Demo

GitHub Repository

Browse the source, grab the v1.0.0 release, or open an issue. The theme is free and open source under GPL-2.0-or-later.

View on GitHub

How It Was Built

A plain-language build log: the languages used, every step in order, the tests that ran and the problems fixed along the way.

Read the Build Log
Engineering Takeaway

A Light Theme That Stays Up to Date

Block themes put the design in data, so a whole new look is seven colours and the owner's details live in one place. Sinag gives small businesses a fast site they can actually keep current. Want it set up for your shop, clinic or cooperative, with your menu and photos?

Kapehan sa Burol, its prices and its phone number are fictional sample content. In version 1.0.0 the editor shows each pattern's sample text; your saved Business Details appear on the live site.

Efraim Ray
Written by

Efraim Ray

Software Developer and AI Specialist. BS Information Technology graduate. I pride myself on being conscientious, attentive to detail, and always open to learning — because the best solutions come from listening, taking notes, and exploring what's next.

Comments