We are glad to present you with a new advanced Speaker feature that provides flexible settings for voicing your posts or pages. First of all, as you already know, the Text to Speech plugin now supports custom post types and is compatible with almost all themes or plugins that include custom post types. Since posts can contain different types of fields, the question accordingly arises of how to generate audio from the text only for certain fields, depending on the needs of the users. This question was resolved by adding Speech Templates support that allow you to create separate speech templates for each type of post.
Before starting work with the speech templates, decide what types of posts you would like to voice and select them in the plugin settings via Speaker → Post Types.
How to manage the speech templates
Edit or create a new page/post, add the necessary content and press Publish or Update. Once all the changes are saved, you can go to the Speaker block(right sidebar) to manage the speech templates and generate audio.
The current settings block provides a standard set of control for the element:
- adding a new template when clicking on the plus
- editing the selected template when clicking on the pencil
- set the selected template as default for the current post type by clicking on the flag
- deleting the created template
- the “Create audio” button allows you to generate audio for the current post according to the selected template.
What is “Content” speech template
The “Content” speech template is set as default for all post types if any template is not assigned in the plugin settings as default for the current post type. The “Content” template is universal and creates audio for the main content of a post/page. If you use regular posts or you don’t need to voice additional fields, the default template is the easiest way. Besides, as an extra option, you can include the post title when generation the audio via Voice → Read the Title. With the default settings of the speech templates, you get the base way for Speaker until version 3.0 to generate audio.
How to create a new speech template
In case you use custom post types and want to generate audio for certain post fields, not just for the main content, you need to create a new speech template. Click the “Plus” icon in the Speaker block when editing or creating a post to move to the template editor.
On the left side, all available blocks of the current page are displayed, which you can add to the speech template by clicking on the necessary element.
On the right side, there is displayed directly the speech template editor with all selected elements.
Speech template editor
Work in the editor starts with the “Template Name” field. When adding a new template, a random name is generated and you need to change it so the name will be clear for you.
The section contains all page elements that will be included when generating audio. There are provided regular options to manage the page elements, such as adding, editing and deleting. Besides, you can change the order of the elements by dragging them.
To add a new page element to the speech template, just click on an appropriate block on the page(on the left side)
Apart from the elements that can be selected on the page, you can add custom elements via the “Add Elements” button on the bottom of the editor. There are available such items:
- Element – a field for advanced users, the option allows you to add a custom xPath.
- Text – an option provides a field to add custom text that will be voiced but not displayed on the page.
- Pause – an option provides for adding a pause of the specified duration. The value is specified in milliseconds.
Do not forget to click Save Speech Templates after changing the settings. After clicking this button, the settings will be saved and applied to the current page.