| 开发者 | wimmelstein |
|---|---|
| 更新时间 | 2026年11月20日 04:00 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
amazon_url, its card also gets a "Read on Amazon" link.essay-tools-rail: the table of contents and related essays go into the rail. The reading time also goes at the end of a group with the class essay-tools-card.essay-tools-rail. There the table of contents and related essays sit out of the reader's way, and fold into one line on a phone. The author's own theme, Lexis, is built that way.
Privacy
The plugin makes no external requests and sets no cookies. Listen uses the speech engine of the visitor's own browser. Text size keeps the visitor's choice in their own browser (localStorage, key peritext-reading-tools-text-scale); it is never sent to the site.
For plugin authors: your own reading views
The tools know one kind of page for reading: a single post. A plugin that shows text in other views (a book's chapters, the whole book on one page, a course) adds them with a filter. The tools are then placed and active there too, and Reading Tools needs to know nothing else about them.
peritext_reading_tools_is_reading_view (bool) decides whether the current page is for reading. Default: is_singular( 'post' ). The second argument is the queried object.
add_filter( 'peritext_reading_tools_is_reading_view', function ( $is_reading_view, $queried_object ) {
return $is_reading_view || is_singular( 'my_chapter' );
}, 10, 2 );
peritext_reading_tools_content_selector (string) names the element that holds the text: the one Listen reads aloud, text size scales and the table of contents is built from. Default: .wp-block-post-content, the Post Content block. Any CSS selector; the first match on the page is used.
add_filter( 'peritext_reading_tools_content_selector', function ( $selector, $queried_object ) {
return my_plugin_is_whole_book_view() ? '.my-book-text' : $selector;
}, 10, 2 );
With the default selector the table of contents is built on the server from the post's headings. With your own selector it is built in the browser from the h2 and h3 headings inside your element, which get an id if they have none.
In a block theme, the template your view uses gets the same default placement as a single post (under the title, above and below the Post Content block). In the Site Editor the tools show in the single post templates only, since the editor has no page to ask the filter about.
/wp-content/plugins/, or install it from Plugins > Add New.Yes, with any block theme. On a single post the plugin places the tools by itself: reading time, Listen and text size under the title, a folded table of contents above the text, related essays below it. The styles follow your theme's colors and fonts, in light and dark. If your theme has a template with a Group that carries the class essay-tools-rail, the table of contents and related essays go there instead. A classic (non-block) theme is not supported; add the blocks to a block-based page or post instead.
WordPress places hooked blocks when a template is saved, not afterwards. Open the template in the Site Editor and save it once, or add the blocks by hand. If you deleted a tool in the editor, WordPress remembers and does not put it back.
Yes: see "For plugin authors" above. Two filters, peritext_reading_tools_is_reading_view and peritext_reading_tools_content_selector, say which pages are for reading and which element holds their text.
The headings keep their size on purpose: A+ is for reading comfort, and the headings already stand out. Text size scales the text element; anything sized relative to it grows with it.
Settings > Reading Tools. One checkbox per tool; it applies to every theme, including a reading rail.
Use the peritext_words_per_minute filter; the default is 200 words per minute.
Pages get the Tags box so the Tagged page template can show the posts with those tags. Tag archives still list posts only.
It needs WordPress 6.7 or later. In an older version the plugin does not run its template; the blocks remain.
peritext_reading_tools_is_reading_view and peritext_reading_tools_content_selector add your own views for reading; Listen, text size and the table of contents work on their text.