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.
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.
pressgrid and .pot template in /languages/.Prerequisites
Requirements
| Requirement | Minimum | Recommended |
|---|---|---|
| WordPress | 6.3 | 6.7+ |
| PHP | 8.0 | 8.2+ |
| MySQL / MariaDB | 5.7 / 10.3 | 8.0 / 10.6+ |
| Browser | All modern browsers (ES2017+, CSS Grid) | |
Setup
Installation
Method 1 — WordPress Admin Upload
- 1UploadGo to
Appearance → Themes → Add New → Upload Theme. Selectpressgrid-v2.zipand click Install Now. - 2ActivateClick Activate on the theme page, or go to
Appearance → Themes. - 3Configure ColorsGo to
Appearance → Customize → PressGrid: Colorsto adjust the default red/black palette. - 4Add Social LinksGo to
Appearance → Customize → PressGrid: Social Mediaand add your Facebook, X/Twitter, YouTube, and Instagram URLs. - 5Build LayoutGo to
Appearance → Layout Builderand configure homepage sections — including the new Opinion section. - 6Set 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
Appearance → Customize
Customizer
All visual settings are managed through the WordPress Customizer with live preview via postMessage CSS variable transport.
Color Panel
| Setting | CSS Variable | Default (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.
| Setting | Mod Key | Icon |
|---|---|---|
| Facebook URL | pressgrid_social_facebook | f |
| X / Twitter URL | pressgrid_social_twitter | 𝕏 |
| YouTube URL | pressgrid_social_youtube | ▶ |
| Instagram URL | pressgrid_social_instagram | ◎ |
Layout Options
| Setting | Options |
|---|---|
| Sidebar Position | Right / Left / None (Full Width) |
| Breaking News Bar | Enable / Disable |
| Breaking News Category | Category ID — 0 = all posts |
| Developer Credit | Show / 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:
| Variable | Font | Used For |
|---|---|---|
--font-display | Playfair Display (700/800/900) | Post titles, section headers, masthead |
--font-ui | Barlow Condensed (400–800) | Navigation, tabs, buttons, labels |
--font-body | Barlow (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.
Available Sections
| Section | Default Layout | State | Description |
|---|---|---|---|
hero | hero-grid | On | 1 large article left + 3 thumbnail sidebar stack right |
latest_posts | grid-3 | On | Most recent posts in configurable grid with sidebar |
category_grid | grid-4 | On | Posts from a specific category (transient cached) |
trending | list | On | 3-column tab block: Trending Now + Editor's Picks + Video |
editor_picks | grid-4 | Off | Standalone editor picks grid, random, 30-min cache |
opinion | grid-2 | On | 2-column opinion items with author avatar — new in v2 |
newsletter | newsletter | On | Full-width newsletter CTA section |
custom_html | custom_html | Off | Free-form HTML (wp_kses_post sanitized) |
ad_block | ad_block | Off | Renders the between-posts ad zone inline |
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 ID | Location | Typical Size |
|---|---|---|
header | Below sticky navigation | 728×90 |
sidebar_top | Top of sidebar — above primary widget area | 300×250 |
sidebar_middle | Between sidebar widget areas | 300×250 or 300×600 |
in_article | Above article content on single posts | Responsive |
between_posts | Homepage Ad Block section | Responsive |
footer | Above site footer | 728×90 |
Rendering in Templates
pressgrid_render_ad( 'sidebar_top' ); pressgrid_render_ad( 'header' ); pressgrid_render_ad( 'footer' );
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
- 1Upload fontSelect a
.woff2file (max 1MB). MIME type is validated against WOFF2 magic bytes before saving. - 2Set family nameGo to
Appearance → Customize → Typographyand enter the font-family name (e.g. MyFont). - 3Apply to elementsCheck: Body, Headings, Menu, or Buttons. The fallback stack (Georgia / Arial) is always preserved.
.htaccess restricting access to .woff2 only.Engineering
Performance Architecture
Transient Cache Strategy
| Transient Key | TTL | Cleared When |
|---|---|---|
pressgrid_hero_posts | 5 min | save_post / delete_post |
pressgrid_trending_posts | 10 min | save_post / delete_post |
pressgrid_cat_grid_{id} | 5 min | Per-category on post save |
pressgrid_editor_picks | 30 min | save_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
| Filter | Default | Description |
|---|---|---|
pressgrid_content_width | 860 | Global $content_width in pixels |
excerpt_length | 20 | Words in auto-excerpts |
wp_headers | — | Security 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
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
- New design system — Classic newspaper aesthetic: black/white/red palette (
#cc0000primary,#1a1a1ablack), 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.phptemplate with ad zones, primary/secondary widget areas, and built-in newsletter email widget - Social Media Customizer panel — New
pressgrid_socialsection 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
- 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