The 100% Original Theme for LezWatch.TV
Based on the Yikes! Starter Theme, the LezWatch.TV theme has been customized for custom post types (shows, characters, actors) and to be as queer as possible.
Usage documentation can be found at docs.lezwatchtv.com
Server crontab is used to run CLI commands that generate and update complex content.
The command wp lwtv generate cron daily
will run a different debugger each day, update the FacetWP cache, and so on.
It's recommended to use Homebrew on macOS or Chocolatey for Windows to install the project dependencies.
git clone git@github.com:lezwatch/lwtv-underscores
cd lwtv-underscores
nvm use
npm install
npm run updater
npm run build
All pull requests should be made to production.
production
branch as base, create a new branch with a descriptive name like fixing-charts
or fix/chartjs421
or feature/latest-posts
. Commit your work to that branch until it's ready for full testingproduction
branch.npm run merge-to-develop
to push it to development (no extra PR needed).production
and the job is done!To install and update:
$ npm install
- Install all the things.$ npm run updater
- Updates all the things.$ npm run build
- Builds all the CSS and handles composer versions.To run linting:
$ npm run lint
- Lint everything$ npm run lint:css
- Lint all SCSS files in all folders$ npm run lint:js
- Lint all Block JS files only$ npm run lint:php
- Lint all PHP files (excludes 3rd party plugins)To fix lint issues automatically:
$ npm run fix
- Fix everything$ npm run fix:css
- Fix all SCSS files in all folders$ npm run fix:js
- Fix all Block JS files onlyIf you're updating CSS you have a couple options, since it's all SCSS.
$ grunt watch
- run grunt and leave open for ongoing changes.$ grunt build
- run the build process once.$ npm run build
will build all the CSS and JS, as well as update all the libraries.
JS and PHP libraries are included via NPM and Composer. WordPress plugins that have been forked are now included in the main code and managed by us to prevent breakage.
The vendor
and node_module
files are not synced to Github anymore (as of 2023-August) to minimize the amount of files stored on the servers, and the following libraries have their required code moved via Composer and npm's post-install process:
NPM
Composer
Pushes to branches are automatically deployed via Github Actions as follows:
/plugins/
)The following plugins are forked from their original versions to support newer versions of WordPress and PHP. They are stored in the /plugins/
folder:
cmb-field-select2
- Forked from MustardBeescmb2-attached-posts
- Forked from WebDevStudioscmb2-grid
- Forked from Oraggamifacetwp-cmb2
- Forked from WebDevStudiosshadow-taxonomy
- By PatelUtkarsh/plugins/lwtv-plugin/
)Formerly hosted as it's own, separate, plugin, it has been combined with the theme since everything is interconnected. For the plugin, we use Namespaces and auto-loading in order to properly generate and call new content dynamically.
A component can be thought of as a sub-plugin. It is an atomic, independent module that stores business logic related to a specific feature. It may expose some template tags (functions) that can be called from within the theme.
All Components are stored in /plugins/lwtv-plugins/php/
and the details of their use in /plugins/lwtv-plugins/php/readme.md
Development is fully documented in /plugins/lwtv-plugins/php/blocks/README.md
The follow is a description of all the files in the code and more or less what they do.
functions.php
- Main Plugin file. Loads auto-loader, components, and defines./assets/
- Plugin assets/bin/
- Scripts used for PHP Unit Testing/php/
- All functional codeIn addition, on build there are two folders (/node_modules/
and /vendor/
) which are used for building code and are not stored on Github.
Stored in /assets/
CSS (css
)
author-box.css
- CSS for the Author Box (will be moved eventually)cmb2.css
- CMB2 Stylingenvironment.css
- Custom styling for server environmentlwtv-tools.css
- Style for the LWTV admin pagesplugin-age.css
- Style to display plugin agepost-statuses.css
- Styling for display of post statusessymbolicons-admin.css
- Symbolicons CSStheme.bootstrap_4.min.css
- Tablesorter CSS for Bootstrap themeswp-admin.css
- WP Admin CSSImages (images
)
diane-fuck-off.gif
- Diane flipping people offlezwatchtv.png
- login page iconsrainbow.svg
- Logo for admin panelsquare.svg
- Plain square logo (for fallback)toaster.png
- A toaster icon (used when no featured image is found)unicorn.png
- Unicorn (used if a toaster cannot be loaded)/scores/
- Logos and images used for show gradesJavascript (js
)
chart.min.js
- Stat charts from ChartJSchart.min.js.map
- Map for Chartschart.umd.js.map
- Map for Charts (got renamed, movin' on)chartjs-plugin-annotation.min.js
- Annotations for ChartJScmb2_ajax.js
- Ajaxified code for CMB2 and post editsfacetwp-pagination.js
- Facet WP paginationjquery.tablesorter.js
- Allow for table sortingjquery.tablesorter.min.js
- Allow for table sortingpalette.js
- Colors for chartspalette.min.js
- Colors for chartsStored in /php/
class-plugin.php
- Main plugin file. All new components will be added thereAll top-level components, stored in /php/_components/
- Many components have 'sub-components' stored in a folder of the same name. For example, class-queeries.php
calls code stored in /php/queeries/
and so on. As long as the proper namespaces are applied, they will be autoloaded.
class-admin-menu.php
- LWTV custom admin menuclass-block-types-allowed.php
- Filter to remove/hide certain blocksclass-blocks.php
- Gutenberg Blocksclass-calendar.php
- Calendarclass-cpts.php
- Custom Post Typesclass-dashboard-widgets.php
- Dashboard Widgetsclass-debugger.php
- Debuggerclass-features.php
- General featuresclass-grading.php
- Show Scores / Gradingclass-of-the-day.php
- Of The Day RSSclass-plugins.php
- Plugin filters and actionsclass-queeries.php
- Customized loopsclass-rest-api.php
- Rest API codeclass-statistics.php
- Statisticsclass-symbolicons.php
- Symboliconsclass-theme.php
- Theme codeclass-this-year.php
- This Year featuresclass-transients.php
- Transientsclass-wp-cli.php
- WP CLI codeIn addition there are interfaces uses by the classes:
interface-component.php
- Interface for classes that act as plugin components.interface-conditional.php
- Interface for classes that are conditional.interface-templater.php
- Interface for classes that return template functions.Helper files are not used as 'code' per-sey but our code relies on them.
class-autoload.php
- Autoloaderclass-utils.php
- common utility functionsStored in /php/admin-menu/
-- Makes admin menu items
class-exclusions.php
- Lists any exclusions or overrides applied by admins (i.e. forcing someone to show as queer)class-monitors.php
- Services monitored (runs daily)class-validation.php
- Data consistency checks (each one runs weekly)Stored in /php/blocks/
class-serverside.php
- Server-side Renders: Run PHP code in JS blocksSource (src
)
/_common/
- Code used by multiple blocks/_serverside/
- Code used by server side rendering blocks/featured-image/
- Backend only display of featured image (LWTV Featured Image)/grade/
- Block to display a 'grade' and review of an individual episode/pre-publish/
- Checks before a post can be published/screener/
- Screener reviews of a show as a whole/spoiler/
- Spoiler warningEach block is broken up by folder with the following files:
block.js
- Main block callerblock.json
- Schema definition file/css/editor.scss
- Style for Editor/css/style.scss
- Style for Front end/js/edit.js
- Editor code/js/save.js
- Save code/js/components/
- (optional) Components used blocksStored in /php/calendar/
:
/ICal
- Subfolder for the ICal Parser Libraryclass-blocks.php
- Code called by the Blocksclass-ics-parser.php
- Connection to the ICS Parser for calendar data.class-names.php
- Process TV Maze names.Stored in /php/cpts/
:
class-actors.php
- Actor CPT codeclass-characters.php
- Actor CPT codeclass-post-meta.php
- Registers post-meta so it can be properly used and hidden from Gutenbergclass-related-posts.php
- Displays related shows and posts (based on tags)class-shows.php
- Show CPT codeclass-tvmaze.php
- TVMaze CPT which helps link our show names to the ones used by TVMazeActors (actors
)
class-calculations.php
- Does the math for various data points used to generate show scores, stores count of number of characters for faster retrieval laterclass-cmb2-metaboxes.php
- CMB2 code to make display nicerclass-custom-columns.php
- Define columns for post listingclass-privacy.php
- Code to allow sections of an actor page to be hidden from outputCharacters (/characters/
)
class-calculations.php
- Does the math for various data points used to generate show scoresclass-cmb2-metaboxes.php
- CMB2 code to make display nicerclass-custom-columns.php
- Define columns for post listingShows (/shows/
)
class-calculations.php
- Show score mathclass-cmb2-metaboxes.php
- CMB2 code to make display nicerclass-custom-columns.php
- Define columns for post listingclass-shows-link-this.php
- Calculations for 'shows like this' (uses Related Posts by Taxonomy)class-ways-to-watch.php
- Taxonomy to allow editors to customize the 'ways to watch' on the fly, based on networks and linksStored in /php/debugger/
-- a collection of all code used to debug and manage content.
class-actors.php
- Find all problems with Actor pages.class-characters.php
- Find all problems with Character pages.class-dupes.php
- Find all duplicate content based on names, IMDB, etc.class-queers.php
- Find all problems with Queer data (i.e. are actors queer, are characters played by queer actors)class-shows.php
- Find all problems with Show pages.Stored in /php/features/
-- a collection of miscellaneous features.
class-author-box.php
- Custom author boxesclass-dashboard-posts-in-progress.php
- Forked version of a plugin to show in progress postsclass-dashboard.php
- Custom column for featured images in posts lists and removal of self pingsclass-embeds.php
- Embeds DisneyABCPress videos, Gleam, GoFundMe, Indiegogoclass-environment.php
- Display notices and settings for serversclass-languages.php
- Support for multiple languages in a dropdown (used by Shows for alt show names)class-missed-schedule.php
- Code to ensure posts don't miss schedulingclass-plugin-age.php
- Display plugin age/last updated on plugin listingclass-private-posts.php
- Shows alert that a page is hidden if the post is set private.class-roles.php
- Custom roles created for curation of contentclass-shortcodes.php
- Various shortcodes - mostly deprecated, but some used by blocks.
[badge url=LINK class="class class" role="role"]TEXT[/badge]
[copyright year=(start year) text=(copyright text)]
[numposts data="posts" posttype="post type" term="term slug" taxonomy="taxonomy slug"]
[firstyear]
[thismonth]
or [thismonth date="2017-01"]
[screener title="Some Like It Hot" summary="A quirky black and white romcom" queer="2" worth="yes" trigger="low"]
(now a block)[author-box users=username]
[gleam url="https://gleam.io/iR0GQ/gleam-demo-competition"]Gleam Demo Competition[/gleam]
[indiegogo url=URL]
[glossary taxonomy=TAXONOMY]
[spoilers]
or [spoilers warning="OMG SPIDERS!!!"]
class-spammers.php
- Prevent Spammers from annoying us.class-upgrades.php
- Handle upgrades of WP and everything included.class-user-profiles.php
- Custom profile codeStored in /php/grading/
- code used to process show grades/scores
class-display.php
- display gradesclass-lwtv.php
- Generate LWTV scoreclass-tmdb.php
- Generate TMDB scoreclass-tvmaze.php
- Generate TVMaze scoreStored in /php/of-the-day/
- code used to generate character and show of the day.
template.php
- Backup of theme template.Stored in /php/plugins/
- all files are used to enhance other plugins installed on the site.
The file _main.php
acts as an autoloader.
class-cache.php
- Custom Cache specific to DreamPress hosting
class-cmb2.php
- Integration with CMB2
/cmb2/
- CMB2 add on libraries
class-attached-posts.php
- Custom code for Attached Postsclass-meta-by-role.php
- Only allow people with certain roles to edit certain post meta.class-metabox-profiles.php
- Add custom metaboxes for user profilesclass-symbolicons.php
- Symbolicon integration for taxonomies.class-taxonomies.php
- Custom filters for taxonomies so they display properly in meta boxes.class-year-range.php
- Year Range -- 'date_year_range' custom field typeclass-comment-probation.php
- Fork of abandoned pluginclass-facetwp.php
-- Facet WP
/facetwp/
- FacetWP Folder
class-indexing.php
class-labels.php
- Custom labels when changing display optionsclass-pagination.php
- Only show pagination if there's more than one pageclass-gravity-forms.php
- Gravity Forms Integration
/gravity-forms/
- Gravity Forms Folder
class-gf-approvals.php
- Approval Code (forked from another plugin)class-stop-spammers.php
- Block Spammersclass-gutenberg.php
- make Block Editor stop being such a dillhole and forget preferencesclass-jetpack.php
- Jetpack integration
class-related-posts-by-taxonomy.php
- Filters to allow a custom layout for "Shows Like This"class-wp-rocket.php
- Integration with WP Rocket to flush content when interrelated posts are updatedclass-yoast.php
- Custom Yoast controlsStored in /php/queeries/
- Custom arrays and WP_Query calls that are repeated in multiple places.
class-get-id-from-slug.php
- Get post ID from slug/URLclass-is-actor-queer.php
- Determine if actor is queer (yes/no)class-is-actor-trans.php
- Determine if an actor is trans (yes/no)class-is-show-on-air.php
- Determine if a show is on air or not (bool)class-post-meta-and-tax.php
- Generate an array of posts that have a specific post meta AND a specific taxonomy value. Useful for getting a list of all dead queers who are main characters (for example).class-post-meta.php
- Post Meta Array returns the whole post data. Can handle compares and likesclass-post-type.php
- Generate an object of all posts in a specific post type.class-related-posts-by-tag.php
- Related Posts by Tags.class-tax-two.php
- Taxonomy Two Array is used for generating a query of posts that are in two taxonomiesclass-taxonomy.php
- Taxonomy Arrayclass-wp-meta.php
- SQL version of meta query (not currently used)Stored in /php/rest-api/
- These files generate the REST API output.
class-alexa-skills.php
- Builds the basic Alexa API (see also Alexa Skills section below)class-byq.php
- LezWatch.TV Plugin (formerly Bury Your Queers)
class-export-json.php
- Export content in JSON format. Mostly used for WikiData and Universities.class-fresh-json.php
- Generates 'whats new' contentclass-imdb-json.php
- API to communicate with IMDb and generate information (used by Alexa)class-list-json.php
- Generates listsclass-otd-json.php
- X Of The Day API service. Every 24 hours, a new character and show of the day are spawnedclass-shows-like-json.php
- Similar shows.class-stats-json.php
- JSON API version of the stats (mostly)class-this-year-json.php
- Outputs simplified lists of what happened in a given year.class-what-happened-json.php
- Outputs data based on what happened in a given year, year-month, or specific day.class-whats-on-json.php
- What's on TV tonight (or tomorrow).Alexa Skills (/php/rest-api/alexa/
)
class-byq.php
- Old BYQ codeclass-common.php
- Code used by multiple Alexa skillsclass-flash-brief.php
- Since the flash brief has trouble with media in post content, we've made our own special version.class-newest.php
- Generate the newest shows or characters (or deaths)class-shows.php
- Skills for interactions with shows (similar shows, recommended shows, etc.)class-this-year.php
- Gives you an idea how this year is going...class-validate.php
- Validates the requests as coming from Amazonclass-whats-on.php
- Generates what's on TV stuff.class-who-are-you.php
- Runs all code that discusses actors, characters, and shows.Templates (/php/rest-api/templates/
)
export-json.php
- uses var query data to determine what to show.Stored in /php/statistics/
- These files generate everything for stats, from graphs to the rest API stuff.
class-gutenberg-ssr.php
- Gutenberg Server side rendering to show statsclass-matcher.php
- Data Matcher
const BUILD_CLASS_MATCHER
- Array of data types to classesconst FORMAT_CLASS_MATCHER
- Array of format types to classesconst META_PARAMS
- Array of custom params for meta data searchesclass-query_vars.php
- Query Variables customization (to make virtual pages) and Yoast metaclass-the-array.php
- Builds the array via make()
class-the-output.php
- Builds the output make()
Build (/php/statistics/build/
)
Each file has a make()
function which build an array that will be passed to the formatter code and output.
class-actor-char-dead.php
- Stats for dead character per actor.class-actor-char-role.php
- Stats for character role type (regular, etc) per actor.class-actor-chars.php
- How many actors or characters per actor or character...class-complex-taxonomy.php
- How many characters are played by out queer actors, but also how many characters for each term.class-dead-basic.php
- Simple counts of all shows with dead, or all dead charactersclass-dead-complex-taxonomy.php
- Complex death taxonomies for stations and nations.class-dead-list.php
- Array for dead characters as a listclass-dead-meta-tax.php
- Generate array to parse taxonomy content as it relates to post metas (for dead characters)class-dead-role.php
- Array for dead characters by role (regular, etc)class-dead_shows.php
- Array of shows with (and without) dead characters, but because of Sara Lance, we have to cross relate to make sure all the shows with death have actually dead characters (yes, a show can have a dead-flag but no actively dead characters)class-dead-taxonomy.php
- Taxonomy Array for dead charactersclass-dead-year.php
- Simple counts of death by year (Sara Lance...)class-meta.php
- Generate array to parse post meta dataclass-on-air.php
- Shows or characters on air per yearclass-scores.php
- Show Scoresclass-show-roles.php
- Roles of characters on Shows, with how many of each role are deadclass-taxonomy-breakdowns.php
- generates complex arrays of cross related data from multiple taxonomies to list 'all miniseries in the USA' (this one makes us cry)class-taxonomy.php
- Parse taxonomy contentclass-this-year.php
- Generate this year dataclass-yes-no.php
- Generates data for content that has Yes/No values (shows we love, on air)Formats (/php/statistics/formats
)
Each file has a build()
function which formats the arrays build in the build
section (above) for proper display.
class-averages.php
- Averages, highs, and lows (ex show scores)class-barcharts-stacked.php
- Stacked Barcharts (also horizontal)class-barcharts.php
- Horizontal barchartsclass-lists.php
- Table lists with simple countsclass-percentages.php
- Table lists with percentages and a barclass-piecharts.php
- Piecharts (actually donuts...)class-trendline.php
- Trendlines (against a vertical barchart)
calculate_trendline()
- Calculates trendline datalinear_regression()
- Calculates linear regressionTemplates (/php/statistics/templates/
)
Templates used by the shortcodes and Gutenberg (as well as when included on the pages themselves).
actors.php
- Actor statscharacters.php
- Character statsdeath.php
- Death statsformats.php
- Formats (tv series, web series, etc) statsmain.php
- Main stats pagenations.php
- Nation statspost_type_actors.php
- Partial for showing the character stats for a single actorshows.php
- Show statisticsstations.php
- Networks/Stations statisticsStored in /php/theme/
- Code used to generate data primarily for the theme in weird ways. Each class file has a make()
function that generates the output. Some have sub-sets.
class-actor-age.php
- Returns actor age.class-actor-birthday.php
- Boolean return if an actor is having a birthday.class-actor-characters.php
- List all characters for an actor.class-actor-pronouns.php
- Sort actor pronouns.class-actor-terms.php
- List simple terms for actors (i.e. gender, sexuality)class-character-relationships
- IDs of all characters a specific character (i.e. Sara Lance) has had a relationship with.class-content-warning.php
- If a show has a content warning, we display it.class-data-author.php
- Generate and return data for Authors (Mika, Tracy, Etc.)
function social()
- Social Media for authorsfunction favorite_shows()
- Favorite Showesclass-data-character.php
- Generate character Data
function actors()
- Generate data for Actorsfunction cliches()
- Generate data for Clichésfunction dead()
- Generate data for Dead charactersfunction oneactor()
- Generate data for PRIMARY Actorfunction oneshow()
- Generate data for PRIMARY showfunction shows()
- Generate data for all shows a character is onfunction terms()
- Generate and return term data related to character (gender, pronouns, etc)class-do-math.php
- Generates the 'recalculate data' button for editors on the front end, to refresh interrelated contentclass-show-characters.php
- Generate and return list of Characters from a showclass-show-stars.php
- Make show starsclass-stats-symbolicon.php
- Makes the icon/title for symboliconsclass-taxonomy-archive-title.php
- Customize title of archives with pretty iconsclass-theme-config.php
- All theme configuration codeclass-tvmaze.php
- Calls to TVMaze (uses episodes()
instead of make()
)class-ways-to-watch.php
- Outputs Ways to WatchStored in /php/this-year/
- Technically a subset of statistics, This Year shows you just the data for the indicated year.
class-display.php
- Controls individual pages
function navigation()
- Builds the nav footer shown in display()
class-generator.php
- Wrapper to generate content and arraysclass-the-array.php
- Builds the arrayclass-the-output.php
- Builds the pretty outputBuild (/php/this-year/build/
)
Each file has a make()
function which build an array that will be passed to the formatter code and output.
class-characters-dead.php
- Generates data for dead charactersclass-characters-list.php
- Generates data for all charactersclass-overview.php
- Builds the data for the overview pageclass-shows-list.php
- Generates data for all show pagesFormats (/php/this-year/formats
)
Each file has a make()
function which formats the arrays build in the BUILD section (above) for proper display.
class-characters.php
- List of Characters on air separated by showclass-chart.php
- Outputs charts (currently only used on the default page)class-dead.php
- Outputs dead contentclass-overview.php
- Outputs front page of this-yearclass-shows.php
- Outputs all show pages dynamicallyStored in /php/validator/
-- Called by /php/admin-menu/class-validation.php
class-actor-checker.php
- Check actors for valid dataclass-actor-imdb.php
- List actors missing IMDbclass-actor-wiki.php
- Check actors wiki data (NOT CURRENTLY USED)class-character-checker.php
- Check characters for valid dataclass-duplicates.php
- Look for duplicate shows/actors/charactersclass-queer-checker.php
- Check that all characters for queer actors are marked properlyclass-show-checker.php
- Check shows for valid dataclass-show-imdb.php
- List shows missing IMDbclass-show-urls.php
- Check Ways-To-Watch URLsStored in /wp-cli/
-- All code for WP-CLI
cli-calc.php
- Calculations on content (scores, character count, etc) - wp lwtv CALC [ID]
cli-check.php
- Data validation checkers - wp lwtv CHECK [queerchars|wiki] [id]
cli-dupes.php
- List all duplicate content - wp lwtv dupes
cli-generate.php
- Generate custom content - wp lwtv GENERATE [otd|tvmaze]
cli-shadow.php
- Build out shadow taxonomy connections - wp lwtv shadow [shows|actors] [ID (optional)]
The following folders/files are for use by Developers. They are not pushed to the dev nor production servers.
./.github/
- all Github specific files such as workflows, dependabot, and pull request templates/.husky/
- all Husky commands/.vscode/
- default VSCode settings.editorconfig
- Basic editor configuration.gitignore
- Files and folders to be exempt from Git syncs.npmrc
- NPM configuration requirements.nvmrc
- NVM version controlcomposer.json
- Composer settings, includes all libraries usedpackage-lock.json
- Saved package.json datapackage.json
- NPM configuration, commands, and libraries usedphpcs.xml.dist
- PHPCS configurationpointsbuild.js
- script run at the end of NPM to move files to the correct location.