-
Notifications
You must be signed in to change notification settings - Fork 0
Functionality
The site implements three custom WP_Query instances, each owned by a different team member.
Purpose: Display posts ordered by popularity based on view count.
| Property | Detail |
|---|---|
| Location | page-trending.php |
| Meta Key | _post_views_count |
| Order | Descending (most viewed first) |
| Page | Trending in Tech |
This query uses meta_key ordering to surface the most-read content, providing readers with a curated view of popular articles.
Purpose: Allow users to filter articles by category and/or date range with paginated results.
| Property | Detail |
|---|---|
| Location | inc/shortcode-category-filter.php |
| Shortcode | [tdf_category_filter per_page="6"] |
| Used On | Article archive (archive-article.php), Home page |
How it works:
-
Category Filtering - Uses
tax_queryto filter by category taxonomy slug, passed via?article_cat=slugURL parameter -
Date Range Filtering - Uses
date_querywithafterandbeforeparameters from?from=YYYY-MM-DD&to=YYYY-MM-DDURL parameters -
Pagination - Reads the
pagedquery variable and passes it toWP_Query - Combined Filtering - Category and date filters can be used simultaneously; state is preserved across pagination
Input Sanitization:
- Category slugs sanitized with
sanitize_key() - Date values sanitized with
sanitize_text_field()and validated throughstrtotime()
UI Components:
- Category pill tabs displaying all categories (excluding "Uncategorized")
- Date range form with From/To date inputs
- 3-column responsive grid of article cards
- WP-PageNavi pagination with fallback to
paginate_links() - Empty state message when no results match
Purpose: Connect opinions to their related articles and vice versa using ACF relationship fields.
| Property | Detail |
|---|---|
| Location | single.php |
| Field |
related_article (ACF Relationship) |
On an Article page: Runs a meta_query searching for Opinion posts whose related_article field contains the current article's ID (using LIKE comparison). Displays linked opinions with their pull quotes, authors, and dates.
On an Opinion page: Retrieves the related Article post from the ACF relationship field and displays it as a card with thumbnail, title, excerpt, and date.
User management is configured automatically during theme setup and enhanced with the Members plugin.
- Front-end user registration is enabled (
users_can_register = 1) - New users are assigned the Contributor role by default
- Registration allows new writers to submit content for editorial review
| Role | Content Capabilities | Admin Capabilities |
|---|---|---|
| Administrator | Create, edit, publish, and delete all content (articles, opinions, reviews, posts) | Full site management — plugins, themes, settings, user management |
| Editor | Create, edit, publish, and delete all content including other authors' posts | Moderate comments, manage categories and tags |
| Contributor | Create and edit own posts (articles, opinions, reviews) — cannot publish (must submit for review) | No admin access beyond own draft management |
| Subscriber | Read published content and post comments | No content creation or admin access |
Key distinction: Because all three CPTs (Article, Opinion, Review) use capability_type => 'post', WordPress post capabilities apply uniformly. Contributors can draft content for any CPT but an Editor or Administrator must publish it. ACF fields (including star ratings on Reviews) are visible to any role that can edit the post.
The Members plugin provides a UI for fine-grained capability management, allowing the team to customize what each role can do beyond WordPress defaults.
- Comments are enabled on all post types (Article, Opinion, Review, and standard Posts) via
'comments'in each CPT'ssupportsarray - Comments are rendered on single post views via
comments_template()with threaded reply support - Default comment status is open site-wide (
default_comment_status = open) - First-time commenters require moderation (
comment_moderation = 1) - Commenters must provide name and email (
require_name_email = 1) - Subscribers and logged-in users can post comments; anonymous visitors must provide name and email
WordPress core search is available site-wide. The Article and Opinion CPTs are registered with 'publicly_queryable' => true, making their content discoverable through the default WordPress search functionality.
The category filter shortcode provides an additional discovery mechanism specific to articles, complementing the global search with structured browsing by topic and date.
Three custom plugins were developed for the project, one by each team member.
Location: wp-content/plugins/tdf-breaking-news/
A scrolling headline ticker displayed in the site header.
Features:
- Queries the most recent posts across all public custom post types
- Horizontally scrolling slides with automatic progression
- Manual navigation via previous/next arrow buttons
- Slide counter display (e.g., "01/05")
- Progress bar indicator
- "Trending" label with CSS pulse animation
Admin Settings (Settings > Breaking News):
- Enable/disable toggle
- Scroll speed: 500ms to 10,000ms (default: 3,000ms)
- Maximum headlines: 1 to 20 (default: 5)
Shortcode: [tdf_breaking_news] (placed in header.php)
Files:
-
tdf-breaking-news.php- Plugin registration, settings page, shortcode handler -
css/banner.css- Banner styling and animations -
js/banner.js- Slide transitions and navigation logic
A dynamic post filtering system that updates content without full page reloads, providing a smoother browsing experience.
A scroll-based progress indicator displayed on single post views, showing readers how far they have progressed through an article.
| Shortcode | Parameters | Output |
|---|---|---|
[tdf_breaking_news] |
None | Scrolling headline ticker with navigation |
[tdf_category_filter] |
per_page (default: 6) |
Filterable article grid with category tabs, date range, and pagination |
The theme includes a one-time setup routine (inc/setup.php) gated by a version constant (TDF_SETUP_VERSION). On first admin visit after theme activation, it automatically:
- Activates 9 required plugins
- Creates pages: Home, About Us, Team (child), Mission (child)
- Sets Home as the static front page
- Seeds categories: Mobile Devices, Apple, Google, Samsung
- Builds the primary navigation menu with correct parent-child hierarchy
- Enables Yoast SEO breadcrumbs
- Enables front-end user registration with Contributor as default role
- Enables comments site-wide with first-comment moderation
- Flushes rewrite rules for custom post type permalinks
Bumping TDF_SETUP_VERSION triggers the setup to re-run, allowing team members to propagate environment changes by pulling new code.