Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build & Release Theme Package

on:
push:
tags:
- 'v*'

jobs:
release:
name: Package and Publish Release
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build clean production ZIP archive
run: |
git archive --format=zip --prefix=okfn-chapter/ -o okfn-chapter.zip HEAD

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: okfn-chapter.zip
generate_release_notes: true
draft: false
prerelease: false
38 changes: 28 additions & 10 deletions .github/workflows/test-syntax.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,48 @@
name: Run tests
name: CI & Quality Assurance

on:
push:
branches:
- master
- v3/okfn-chapter
- sweden/okfn-chapter
pull_request:
branches:
- master

jobs:
php:
name: Testing
lint:
name: Lint & Validation
runs-on: ubuntu-latest
env:
PHP_VERSION: '7.4'
PHP_VERSION: '8.2'

steps:
- name: Checkout the project
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup the PHP ${{ env.PHP_VERSION }} environment on ${{ runner.os }}
- name: Setup PHP and Composer
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: phpcs, phpunit
extensions: imagick, mbstring
extensions: mbstring, json, gettext
tools: phpcs

- name: Searching for PHP syntax errors
run: find -L . -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
- name: PHP Syntax Check
run: find -L . -name '*.php' -not -path './vendor/*' -print0 | xargs -0 -n 1 -P 4 php -l

- name: Validate theme.json and Style Variations
run: python3 -c "import json, glob; [json.load(open(f)) for f in ['theme.json'] + glob.glob('styles/*.json')]"

- name: Validate Translation PO Files
run: |
sudo apt-get install -y gettext
for po in languages/*.po; do
msgfmt -c -v -o /dev/null "$po"
done

- name: Validate Clean Production ZIP Packaging
run: |
git archive --format=zip --prefix=okfn-chapter/ -o okfn-chapter.zip HEAD
unzip -l okfn-chapter.zip | grep style.css
unzip -l okfn-chapter.zip | grep theme.json
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Node packages downloaded via "npm install"
node_modules/

# Misc files types
vendor/
*.DS_Store
*.log

# NetBeans project files
nbproject/
.netbeans.xml
.wp-env.override.json
.idea/
*.mo
14 changes: 14 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"core": "https://wordpress.org/wordpress-7.0.4.zip",
"phpVersion": "8.2",
"themes": ["."],
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"SCRIPT_DEBUG": true,
"WP_DEFAULT_THEME": "wordpress-theme"
},
"lifecycleScripts": {
"afterStart": "npx --yes @wordpress/env run cli wp theme activate wordpress-theme"
}
}
19 changes: 0 additions & 19 deletions 404.php

This file was deleted.

97 changes: 0 additions & 97 deletions Gruntfile.js

This file was deleted.

20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

Copyright (C) 2026 Open Knowledge Sweden / Open Knowledge Foundation

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

The full GPL-2.0 text is available at https://www.gnu.org/licenses/gpl-2.0.html
99 changes: 49 additions & 50 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,80 +1,79 @@
# OKFN WordPress Theme
# OK Network Chapter

OKFNWP is a WordPress theme built on Bootstrap.
WordPress **7.0+** block theme for Open Knowledge Network chapters. It ports the [okfn.org](https://okfn.org/) visual identity (palette, HK Grotesk, pill buttons, colour orbs) into core Site Editor and block patterns. No Astra, Spectra, Elementor, or other page-builder plugin is required.

## Getting Started
Version **3.0.0** replaces the deprecated classic `OKFN-WP` 2.0 theme (Bootstrap 4, jQuery, mmenu, Grunt). The classic tree is tagged `classic-2.0.0`.

**You'll need the following installed before continuing:**
First intended deployment: [okfn.se](https://okfn.se/). Other chapters can reuse the theme by swapping the Site Logo and, optionally, the **Chapter green** style variation.

- [Node.js](http://nodejs.org): Use the installer provided on the NodeJS website.
- [Grunt](http://gruntjs.com/): Run `[sudo] npm install -g grunt-cli`
## Requirements

To get started run:
- WordPress 7.0 or later
- PHP 8.2 or later
- No required plugins. Optional: Contact Form 7 for contact pages; Create Block Theme only while developing.

`npm install && grunt watch`
## Local development

## Templates
From this directory:

### **Homepage**

The homepage template is a regular full-width content page. Use the `[latestposts]` shortcode to display the latest blog posts.

## Shortcodes

### **Latest Blog Posts**

To add a 3-column row of the latest blog posts, use:

`[latestposts]`

To change the section heading from the default 'Latest posts from the blog', pass in a title="" parameter:
```sh
npm install
npm start
```

`[latestposts title="Recent Posts"]`
That runs [wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) (WordPress 7.0.4) **and activates this theme**. A plain `npx wp-env start` leaves Twenty Twenty-Five active — WordPress always installs a default theme; ours is mapped in as `wordpress-theme` and must be switched on.

## Coding Standards
| URL | What |
|---|---|
| http://localhost:8888/ | Front end (hero, cards, latest posts, footer) |
| http://localhost:8888/wp-admin/ | Admin. User `admin`, password `password` |

Uses [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer/) as the basis, along with [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards). [PHPCSUtils](https://github.com/PHPCSStandards/PHPCSUtils) and [PHPCSExtra](https://github.com/PHPCSStandards/PHPCSExtra) are also required.
If the site is already running and still shows Twenty Twenty-Five:

### Setup
```sh
npx wp-env run cli wp theme activate wordpress-theme
```

Make sure you are running PHP CodeSniffer 3.7 or above. Clone it from GitHub and add its binaries to the relevant system folders, so you can use `phpcs` or `phpcbf`, without the need to specify the exact path to the binary.
Then reload http://localhost:8888/. You do **not** need to set a Site Logo or rebuild pages to preview: `templates/front-page.html` already inserts the OK Network patterns.

1. Clone https://github.com/squizlabs/PHP_CodeSniffer/ to your home folder.
2. Set symlinks to the binaries of `phpcs` and `phpcbf` container in `~/PHP_CodeSniffer/bin/` with the following commands in any Linux distribution.
PHP syntax:

```sh
sudo ln -s ~/PHP_CodeSniffer/bin/phpcs /usr/bin
sudo ln -s ~/PHP_CodeSniffer/bin/phpcbf /usr/bin
find -L . -name '*.php' -print0 | xargs -0 -n 1 php -l
```

Once symlinks are created, try to execute `phpcs` in the terminal. You should get the following output and it means that you're all set to use PHP CodeSniffer.
## Editing (for volunteers)

```sh
ERROR: You must supply at least one file or directory to process.
1. **Appearance → Editor** (Site Editor).
2. Set **Site Logo** to the chapter landscape logo (colour on white).
3. Open the **Header** template part and edit Navigation links.
4. Open the **Footer** template part (or the Footer pattern) for social URLs and legal links.
5. Build pages from **Patterns → OK Network**: Hero punch, Feature cards, Person card, Quote, Latest posts, Newsletter, Page closing, etc.
6. Button styles: default (black fill), **White fill**, **Pill** (outline). Heading style **Highlight (mono)** uses Necto Mono.
7. Group styles **Blue / Green / Purple / Yellow orb** add the brand colour-circle background.

Run "phpcs --help" for usage information
```
Do not install a page builder. Layout lives in patterns; you change text, images, and URLs.

3. Next, clone https://github.com/WordPress/WordPress-Coding-Standards to your home folder in a subfolder called `wpcs` for your convenience.
## Fonts

4. Clone https://github.com/PHPCSStandards/PHPCSUtils to your home folder
Both faces are **SIL OFL 1.1** and **self-hosted in the theme**. `styles/fonts.css` registers them with local `@font-face` URLs. Nothing is loaded from Google Fonts or any other remote host.

5. Clone https://github.com/PHPCSStandards/PHPCSExtra to your home folder
- **HK Grotesk** — WOFF2 in `assets/fonts/hk-grotesk/` (`OFL.txt`)
- **Necto Mono** — OTF in `assets/fonts/necto-mono/` (`OFL.txt`); used for highlight headings and citations

6. The only thing left to do is to make sure `phpcs` uses these extra sniffs and knows where to find them. We do that by updating it configuration.
## Analytics (Umami)

```sh
phpcs --config-set installed_paths ~/wpcs,~/PHPCSUtils/PHPCSUtils,~/PHPCSExtra
```
Not part of the theme. Use Umami Cloud Hobby and the **Integrate Umami** plugin on the live site. See [docs/umami.md](docs/umami.md). Do not enable it in wp-env.

If the configuration is properly updated, you should get the following output when executing `phpcs -i`.
## What this theme does not do

```sh
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs, WordPress-Extra, PHPCSUtils, NormalizedArrays and Universal
```
- It does not convert classic PHP templates or `[latestposts]` shortcodes automatically. See `docs/migration.md`.
- It does not add Polylang. okfn.se English pages stay as a separate `/en/` tree unless you add a multilingual plugin later.
- It does not inject analytics IDs. See [docs/umami.md](docs/umami.md).

If something is not right and you can't get it to work, use `phpcs --config-show` to see what you have PHP CodeSniffer configured with.
## Licence

### Testing
Theme code: GPL-2.0-or-later.
Content you publish: typically CC BY 4.0, matching Network practice.

Just run `./run_tests.sh` and follow the output. Test will find all kinds of errors and the simple ones will be corrected automatically. For the other ones you'll need to rerun the tests to confirm they have been resolved.
Repository: [github.com/okfse/wordpress-theme](https://github.com/okfse/wordpress-theme)
Loading
Loading