PressGrid v2.0.0  ·  Documentation

WordPress Theme Documentation

WordPress Theme · v2.0.0

PressGrid

A production-ready, security-hardened WordPress theme engineered for high-traffic news and magazine websites. Classic editorial newspaper design, modular layout system, zero JS dependencies, and enterprise-grade security.

WordPress 6.3+ PHP 8.0+ Lighthouse 95+ GPL-2.0+ Vanilla JS WCAG 2.1 AA
95+
Lighthouse
9
Layout Sections
6
Ad Zones
0
JS Dependencies

Core Features

What's Included

PressGrid v2.0.0 combines classic editorial newspaper design with engineering discipline. Every feature is purposefully built for modern news operations.

📰
Newspaper Design
Classic black/white/red palette. Playfair Display headings, Barlow Condensed navigation, hero grid with sidebar stack.
Performance First
Transient caching, deferred JS, lazy images, zero render-blocking resources. ~32KB CSS, no framework overhead.
🔒
Security Hardened
Nonces, capability checks, MIME validation, security headers, full output escaping throughout.
🏗️
Layout Builder
9 configurable homepage sections. Enable/disable, set layout, category, and post count per section.
📢
Ad System
6 zones with mobile/desktop visibility, async loading, and wp_kses sanitization.
🎨
CSS Variables
Full Customizer-driven theming via :root CSS custom properties. Live preview with postMessage transport.
🌍
Translation Ready
Fully translatable with text domain pressgrid and .pot template in /languages/.
📊
SEO & Schema
NewsArticle JSON-LD, Open Graph, Twitter Cards, breadcrumbs, canonical tags on every page type.
WCAG 2.1 AA
Skip links, ARIA labels, keyboard navigation, focus-visible, semantic HTML5 throughout.

Prerequisites

Requirements

RequirementMinimumRecommended
WordPress6.36.7+
PHP8.08.2+
MySQL / MariaDB5.7 / 10.38.0 / 10.6+
BrowserAll modern browsers (ES2017+, CSS Grid)
ℹ️
Cache CompatibilityWP Super Cache, W3 Total Cache, LiteSpeed Cache, WP Rocket, and Redis Object Cache are all fully supported.

Setup

Installation

Method 1 — WordPress Admin Upload

  1. 1
    UploadGo to Appearance → Themes → Add New → Upload Theme. Select pressgrid-v2.zip and click Install Now.
  2. 2
    ActivateClick Activate on the theme page, or go to Appearance → Themes.
  3. 3
    Configure ColorsGo to Appearance → Customize → PressGrid: Colors to adjust the default red/black palette.
  4. 4
    Add Social LinksGo to Appearance → Customize → PressGrid: Social Media and add your Facebook, X/Twitter, YouTube, and Instagram URLs.
  5. 5
    Build LayoutGo to Appearance → Layout Builder and configure homepage sections — including the new Opinion section.
  6. 6
    Set Up MenusGo to Appearance → Menus. Assign menus to Primary, Footer, and Secondary locations.

Method 2 — WP-CLI

wp theme install pressgrid-v2.zip --activate

Method 3 — FTP

# Unzip and upload to:
/wp-content/themes/pressgrid/

Architecture

File Structure

pressgrid/ ├── style.css # Theme header + complete CSS (~32KB) ├── functions.php # Setup, enqueue, transients, SEO, schema ├── header.php # Top bar, masthead, sticky nav, breaking ticker ├── footer.php # Widgets, nav, developer credit ├── index.php # Fallback archive template ├── front-page.php # Layout Builder homepage ├── single.php # Single post with author box ├── archive.php # Category / tag / author archives ├── page.php # Static pages ├── search.php # Search results ├── comments.php # Threaded comments + form ├── sidebar.php # Sidebar: ad zones + newsletter + widgets ├── 404.php # Custom 404 page │ ├── inc/ │ ├── security.php # Headers, XMLRPC toggle, font upload security │ ├── customizer.php # Customizer controls + CSS variable output + social URLs │ ├── typography.php # Secure .woff2 upload admin page │ ├── ads.php # 6 ad zones, wp_kses sanitization, rendering │ └── layout-builder.php # Layout Builder + Security settings admin pages │ ├── template-parts/ │ ├── content/ │ │ ├── post-card.php # Reusable post card component │ │ └── none.php # No results state │ └── layout/ │ ├── hero.php # Hero grid: 1 large left + 3 sidebar stack │ ├── latest-posts.php # Latest posts — grid-2/3/4 or list │ ├── category-grid.php # Category grid (transient cached) │ ├── trending.php # 3-col tab block: Trending + Editor's Picks + Video │ ├── editor-picks.php # Editor picks standalone fallback (cached 30min) │ ├── opinion.php # Opinion section — 2-col items with author avatar │ └── newsletter.php # Newsletter CTA section │ ├── assets/js/ │ ├── main.js # Nav, lazy-load, a11y, smooth scroll (deferred) │ └── customizer-preview.js # Live CSS variable Customizer preview │ ├── languages/ │ └── pressgrid.pot # Translation template │ ├── screenshot.png # 880×660 theme screenshot └── readme.txt # WordPress.org compliant readme

Appearance → Customize

Customizer

All visual settings are managed through the WordPress Customizer with live preview via postMessage CSS variable transport.

Color Panel

SettingCSS VariableDefault (v2.0.0)
Primary Color--pg-primary#cc0000
Secondary Color--pg-secondary#990000
Accent Color--pg-accent#cc0000
Background Color--pg-bg#ffffff
Text Color--pg-text#1a1a1a
Link Hover Color--pg-link-hover#cc0000

Social Media Panel New in v2

Set social profile URLs at Appearance → Customize → PressGrid: Social Media. Configured URLs render as icon links in the black top bar.

SettingMod KeyIcon
Facebook URLpressgrid_social_facebookf
X / Twitter URLpressgrid_social_twitter𝕏
YouTube URLpressgrid_social_youtube
Instagram URLpressgrid_social_instagram

Layout Options

SettingOptions
Sidebar PositionRight / Left / None (Full Width)
Breaking News BarEnable / Disable
Breaking News CategoryCategory ID — 0 = all posts
Developer CreditShow / Hide in footer

Typography

PressGrid v2.0.0 ships with a full editorial font stack loaded from Google Fonts. Three font roles are defined as CSS custom properties:

VariableFontUsed For
--font-displayPlayfair Display (700/800/900)Post titles, section headers, masthead
--font-uiBarlow Condensed (400–800)Navigation, tabs, buttons, labels
--font-bodyBarlow (300–600)Body copy, meta, excerpts, top bar

Appearance → Layout Builder

Layout Builder

Configure the homepage at Appearance → Layout Builder. Each section can be independently enabled, assigned a layout type, source category, and post count.

💡
Transient CacheSaving layout settings automatically clears all PressGrid transients so the new configuration takes effect immediately.

Available Sections

SectionDefault LayoutStateDescription
herohero-gridOn1 large article left + 3 thumbnail sidebar stack right
latest_postsgrid-3OnMost recent posts in configurable grid with sidebar
category_gridgrid-4OnPosts from a specific category (transient cached)
trendinglistOn3-column tab block: Trending Now + Editor's Picks + Video
editor_picksgrid-4OffStandalone editor picks grid, random, 30-min cache
opiniongrid-2On2-column opinion items with author avatar — new in v2
newsletternewsletterOnFull-width newsletter CTA section
custom_htmlcustom_htmlOffFree-form HTML (wp_kses_post sanitized)
ad_blockad_blockOffRenders the between-posts ad zone inline
📘
Trending Section in v2The trending section now renders as a combined 3-column tab block — Trending Now, Editor's Picks, and a Video feature. editor_picks remains available as a standalone fallback if trending is disabled.

Appearance → Theme Ads

Advertisement System

Manage all ad placements at Appearance → Theme Ads. Each zone is independently configurable with HTML or ad network tags.

Ad Zones

Zone IDLocationTypical Size
headerBelow sticky navigation728×90
sidebar_topTop of sidebar — above primary widget area300×250
sidebar_middleBetween sidebar widget areas300×250 or 300×600
in_articleAbove article content on single postsResponsive
between_postsHomepage Ad Block sectionResponsive
footerAbove site footer728×90

Rendering in Templates

pressgrid_render_ad( 'sidebar_top' );
pressgrid_render_ad( 'header' );
pressgrid_render_ad( 'footer' );
🔒
SecurityAll ad HTML runs through wp_kses() with a strict allowed-tags whitelist. Desktop/mobile visibility is handled with .pg-ad-desktop-only / .pg-ad-mobile-only CSS classes.

Appearance → Font Upload

Typography

PressGrid v2.0.0 ships with a complete editorial Google Fonts stack. For custom brand fonts, upload a .woff2 file via Appearance → Font Upload.

Secure Upload Process

  1. 1
    Upload fontSelect a .woff2 file (max 1MB). MIME type is validated against WOFF2 magic bytes before saving.
  2. 2
    Set family nameGo to Appearance → Customize → Typography and enter the font-family name (e.g. MyFont).
  3. 3
    Apply to elementsCheck: Body, Headings, Menu, or Buttons. The fallback stack (Georgia / Arial) is always preserved.
🔒
SecurityValidates WOFF2 magic bytes (0x774F4632), enforces 1MB cap, randomly renames files, stores in a protected directory with .htaccess restricting access to .woff2 only.


Engineering

Performance Architecture

95+
Lighthouse Score
Performance target
0
Render-Blocking JS
All scripts deferred
~32KB
CSS Size
No framework overhead
Low
CLS Score
Explicit image dimensions

Transient Cache Strategy

Transient KeyTTLCleared When
pressgrid_hero_posts5 minsave_post / delete_post
pressgrid_trending_posts10 minsave_post / delete_post
pressgrid_cat_grid_{id}5 minPer-category on post save
pressgrid_editor_picks30 minsave_post / delete_post

Query Optimization

  • No query_posts() — All queries use WP_Query directly
  • no_found_rows: true — Skips SQL_CALC_FOUND_ROWS on cached queries
  • Post ID caching — Only IDs stored in transients, query reconstructed from cache
  • Indexed columns only — No meta_query on unindexed keys
  • Pagination everywhere — No unbounded loops on archive templates

Hardening

Security

  • Every $_POST goes through wp_verify_nonce() + current_user_can()
  • All output escaped with esc_html(), esc_url(), esc_attr(), wp_kses_post()
  • Ad HTML filtered through wp_kses() with strict allowed-tags whitelist
  • Font upload: WOFF2 magic-byte validation, 1MB cap, random filename, protected dir
  • Security headers: X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy
  • WordPress version removed from head and all feeds
  • Author enumeration blocked via /?author=N redirect
  • Login error messages genericized to prevent username enumeration
  • No eval(), no direct DB queries, no obfuscated code
  • Direct file access blocked: if(!defined('ABSPATH')) exit; in every PHP file
  • Optional XML-RPC disable at Appearance → Theme Security
  • All functions prefixed pressgrid_ — no global namespace pollution

Security Headers

X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: geolocation=(), microphone=(), camera=()

Search & Discovery

SEO & Schema

Structured data and social metadata output automatically on every applicable page type.

NewsArticle JSON-LD

{
  "@context": "https://schema.org",
  "@type": "NewsArticle",
  "headline": "Article title",
  "datePublished": "2024-01-01T00:00:00+00:00",
  "author": { "@type": "Person" },
  "publisher": { "@type": "Organization" }
}

Other SEO Features

  • Open Graph: og:title, og:description, og:image, og:type, og:site_name
  • Twitter Cards: summary_large_image with auto-featured image
  • Canonical <link> tag on every page
  • Semantic HTML5: header, main, article, nav, aside, footer
  • Post reading time estimation in meta
  • Breadcrumb navigation with schema-ready markup

Developer API

Hooks & Public Functions

Key Public Functions

pressgrid_breadcrumbs();
pressgrid_post_meta( $post_id );
pressgrid_render_ad( 'sidebar_top' );
pressgrid_get_category_label( $post_id );
$q = pressgrid_get_hero_posts( 4 );
$q = pressgrid_get_trending_posts( 6 );
$q = pressgrid_get_editor_picks( 4 );
$q = pressgrid_get_category_posts( $cat_id, 4 );

Filters

FilterDefaultDescription
pressgrid_content_width860Global $content_width in pixels
excerpt_length20Words in auto-excerpts
wp_headersSecurity headers added here

i18n / l10n

Translation

All user-facing strings use text domain pressgrid. A .pot template is included in /languages/.

WP-CLI

# Generate fresh POT file
wp i18n make-pot . languages/pressgrid.pot --domain=pressgrid

# Compile PO to MO
msgfmt languages/pressgrid-bg_BG.po -o languages/pressgrid-bg_BG.mo

Modular Architecture

Template Parts

Calling with Args

# Category grid with custom args
get_template_part(
  'template-parts/layout/category-grid',
  null,
  array( 'layout' => 'grid-3', 'category' => 5, 'post_count' => 6 )
);

# Opinion section filtered to a specific category
get_template_part(
  'template-parts/layout/opinion',
  null,
  array( 'category' => 7, 'post_count' => 4 )
);

Child Theme Override

# Copy at same relative path inside child theme:
child-theme/template-parts/content/post-card.php
child-theme/template-parts/layout/opinion.php

Infrastructure

Caching

Full CompatibilityWorks with WP Super Cache, W3TC, LiteSpeed, WP Rocket, Redis, and Memcached.

Manual Cache Clear

delete_transient( 'pressgrid_hero_posts' );
delete_transient( 'pressgrid_trending_posts' );
delete_transient( 'pressgrid_editor_picks' );
delete_transient( 'pressgrid_cat_grid_' . $cat_id );

History

Changelog

v2.0.0 Latest Newspaper Design Overhaul
  • New design system — Classic newspaper aesthetic: black/white/red palette (#cc0000 primary, #1a1a1a black), replacing previous blue-accent palette
  • Font stack — Playfair Display (headings) + Barlow Condensed (UI/nav) + Barlow (body) via Google Fonts
  • Top bar — New black strip with current date left and social icon links right; URLs configurable in Customizer
  • Masthead — Centered newspaper-style logo with split-colour name and em-dash tagline
  • Hero section — Rebuilt as 3:2 newspaper grid: full-bleed image with gradient overlay caption left, three thumbnail sidebar items right
  • Trending section — Rebuilt as 3-column tab block combining Trending Now, Editor's Picks, and Video in a single bordered unit
  • Opinion section — New Layout Builder section: 2-column grid with post image, title, and author byline with red arrow
  • Sidebar — New sidebar.php template with ad zones, primary/secondary widget areas, and built-in newsletter email widget
  • Social Media Customizer panel — New pressgrid_social section for Facebook, X/Twitter, YouTube, Instagram URLs
  • CSS overhaul — Full rewrite (~32KB) using newspaper-appropriate spacing, typography scale, and CSS custom properties
  • Footer — Black background, 4px red top border, 4-column widget grid
  • Layout Builder expanded — 8 → 9 sections with the addition of opinion
  • Color defaults updated — All Customizer defaults reflect the new newspaper palette
v1.0.0 Initial Release
  • Full theme architecture: Layout Builder, Ad Zones, Customizer
  • Security hardening: headers, MIME validation, nonces, escaping throughout
  • Transient caching for hero, trending, category, editor picks
  • NewsArticle schema, Open Graph, Twitter Cards
  • Vanilla JS: nav, lazy load, dropdowns, smooth scroll
  • WCAG 2.1 AA accessibility compliance
  • WordPress.org Theme Review guidelines compliance
  • GPL-2.0-or-later license
🔗
Links GitHub Repository ↗  ·  Author Website ↗  ·  Theme by Milen Stanchev