Skip to content
Epiktetos Theme1.0.0
1.0.01 min read

JavaScript Behavior

Front-end and admin JavaScript behavior included in Epiktetos.

Epiktetos enqueues JavaScript conditionally from functions.php and feature classes.

Front-end scripts

HandleFileCondition
epiktetos-headerassets/js/header.jsLoaded on the front end.
epiktetos-categoriesassets/js/categories.jsLoaded on the front page except the saved route.
epiktetos-singleassets/js/single.jsLoaded on singular posts.
epiktetos-readerassets/js/reader.jsLoaded on saved route, front page, single posts, archives, and search.

The header script receives localized strings for controls such as dark mode, light mode, and search.

Admin scripts

Admin classes enqueue scripts for settings screens, wizard behavior, category ordering, and admin tooling where needed. The category order screen uses jQuery UI Sortable.

REST behavior

The search feature registers a public REST endpoint:

Code
/wp-json/epiktetos/v1/search

It accepts a search query argument, requires at least two characters, and returns up to five post results with title, category, excerpt, permalink, date, and reading-time data.

Public endpoint

The search endpoint intentionally uses a public permission callback. Keep the response limited to public post data if extending it.

Related articles