• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Launch A Blog

  • How to start a blog
  • Tools / Resources
  • About / Contact

Amazon Polly / AI WordPress Plugin Customization

Written by Mathias Ahlgren. Last updated on January 21, 2020. 7 comments

You may have noticed that I am turning my blog posts into lifelike speech audio versions. To do this I am using Amazon Polly and here I am going to show you how you can use it and customize it.

Tired of reading? Then listen to this article:
FacebookTwitterPinterestLinkedInEmail

Amazon Polly is a cloud service that enables you to turn text into speech using over 40 unique and lifelike voices. WP Engine and Amazon have created a free plugin to help WordPress users integrate it into their WordPress sites.

Amazon Polly AI Plugin for WordPress

The Amazon AI Plugin for WordPress works on both sites powered with Amazon Web Services (AWS) and those running on other web hosts. Either way, you can use Amazon Polly to generate audio for your blog posts and pages. Plus, it lets you store the audio versions on your own server or using Amazon S3 at a minimal cost.

Here I am not going to show you how to install, set up and configure the plugin. This information is already laid out perfectly on the plugin’s homepage.

But I will show you how to customize Amazon AI Plugin for WordPress, how you can show the player on the homepage and how to move the player position to anywhere you want on a page.

Because out of the box the Amazon AI Plugin for WordPress won’t show the player on the homepage and it only lets you show the player before the post or after the post.

But with a bit of customization you can display the player anywhere on the page, and on the homepage (like I have on my homepage).

amazon polly wordpress plugin move player position

How to move the Amazon Polly / AI WordPress plugin player position and how to show it on the homepage?

It’s really straightforward.

First add the below code into your functions.php file (important: backup your functions.php file before making any changes):

// Move Amazon AI Polly Player Position
function amazon_polly_player_shortcode($atts, $content = NULL) {
global $post;
$tagged_content = '';
if(intval(get_post_meta($post->ID, 'amazon_polly_enable', TRUE))===1) {
$player_source = get_post_meta($post->ID, 'amazon_polly_audio_link_location', TRUE);
$tagged_content = PHP_EOL.''.PHP_EOL.'
<table id="amazon-polly-audio-table"><tbody><tr><td id="amazon-polly-audio-tab">
<div id="amazon-ai-player-label">Tired of reading? Then listen to this article:</div>
<div id="amazon-ai-player-container">
<audio class="amazon-ai-player" id="amazon-ai-player" preload="none" controls="" controlslist="nodownload">
<source type="audio/mpeg" src="'.$player_source.'">
</audio>
</div>
<div id="amazon-polly-subscribe-tab"></div>
<div id="amazon-polly-by-tab"></div>
</td></tr></tbody></table>'.PHP_EOL.''.PHP_EOL;
} else {
$tagged_content = PHP_EOL.'<!-- Amazon Polly not enabled on this post -->'.PHP_EOL;
}
return $tagged_content;
}
add_shortcode('polly_player', 'amazon_polly_player_shortcode');

On line 9 you can customize the player description text Tired of reading? Then listen to this article: to whatever you like.

Then add in the below shortcode into your post or page where you want the player to appear:

[polly_player]

Finally go in to the player position setting in WordPress and select do not show:

amazon polly plugin player settings

That’s it! The Amazon Polly Plugin for WordPress player position should now show up where you have added in the shortcode.

How to start a blog › Amazon Polly / AI WordPress Plugin Customization

Mathias Ahlgren

Hi, I'm Mathias. I'm an online marketer and blogger from Melbourne Australia. I'm here to show you that starting your own blog doesn't have to be hard work and is in fact a lot easier than you think!

Reader Interactions

Comments

  1. Nazim Ansari says

    December 18, 2020 at 4:24 am

    Hi Mathias,

    I have a confusion.

    Will Amazon Polly regenerate the audio file every time I update the content if it enabled?

    If yes, Please guide how we can avoid that?

    Thanks!

    Reply
  2. Fearghal Hendron says

    October 12, 2020 at 7:11 am

    Hey, I’m trying to use this to place the audio in the same position across all posts of the same type. I have a plugin that uses a post type “at_biz_dir”.

    The amazon plugin allows me to add in that post type and have the transcription features for that post type, too. Which is great. Unfortunately it’s showing at the top of the page (for that post type, but I’d prefer to have it appear below the post title (my name) or at the bottom of the bio. See here: https://montessoricommons.cc/directory/fearghal-hendron/

    For normal posts, the positioning that amazon provide is fine.

    I must admit I’m self taught at “chopping together other peoples code” (read: no training or experience), any pointers you could share would be amazing.

    Reply
  3. Aeryn Lynne says

    April 28, 2020 at 8:21 pm

    Great intro info, thanks!

    I have to wonder if the plugin has allowance to hide content. For instance, in this post, the reader was reading out your polly position shortcode text. While a bit humours to hear the first time around, I can imagine this being tedious. It would be good if the plugin can insert tags such as “to learn more about the code behind this shortcode, visit my webpage for more info,” and then remove the code from the recording.

    Anyway, thanks for the heads up. 🙂

    Reply
  4. Vijay says

    April 20, 2020 at 9:17 am

    This plugin is free or paid? if it’s paid how much for a lifetime?

    Reply
    • Mathias Ahlgren says

      April 28, 2020 at 11:53 pm

      It’s a free plugin

      Reply
  5. Kevin says

    March 11, 2020 at 9:53 am

    Great post! I saw this audio player on another website and didn’t know what it was. I came across your website and got the information I was looking for. I am going to get it installed on my website soon. Thanks a lot!

    Reply
  6. Fabio says

    July 13, 2019 at 2:51 am

    Thanks it worked however I have a problem.
    Right before and after the post there is a string of text saying:
    -AMAZONPOLLY-ONLYWORDS-START-
    -AMAZONPOLLY-ONLYWORDS-END-

    Any idea how to fix this?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

mathias

Hi, I'm Mathias. I'm an online marketer and blogger from Melbourne Australia. I'm here to show you that starting your own blog doesn't have to be hard work and is in fact a lot easier than you think!

Join 1000+ other beginner bloggers and subscribe to my NEWSLETTER for my email updates and a FREE 10,000-word guide to starting a successful blog in 2020

Privacy & Cookies Policy

Footer

Download my free 30,000 word ebook on how to start a blog

Join 1000+ other beginner bloggers and subscribe to my NEWSLETTER for my email updates and download my FREE 30,000-word ebook on how to start a blog in 2020

Copyright © 2021 Launch a Blog · Terms & Conditions · Privacy & Cookies Policy · Affiliate Disclaimer · DMCA Protected


English Français Español Português Italiano Deutsch Nederlands Svenska Dansk Norsk bokmål Ελληνικά Русский Türkçe 简体中文 繁體中文 한국어 العربية हिन्दी ગુજરાતી ਪੰਜਾਬੀ বাংলা Filipino 日本語 Bahasa Indonesia Bahasa Melayu Basa Jawa Tiếng Việt