Why won't this block of code display in the home page post excerpt?

<div class="g-ytsubscribe" data-channelid="UCJA8OyDxRY-wm0ya2gtHOsw" data-layout="full" data-count="hidden"></div>

This is the standard code for a YouTube subscribe button. When this is used in a post (and clearly at the top and within the excerpt length max), it will not display in the homepage excerpt.

I tried the exact code with another theme and it does display in the excerpt so it has to be something specific with Travelify. Can the code be tweaked to show it?

Hey there

interesting, never seen this code before and from what i see it should not display anything, just an invisible div… Maybe you used this code along with the plugin? because only this code will not do anything
Can i see an example of your page where this code works and shows subscribe button?

ok, i tried to research your question and seems i found it, you are missing one important part in your code, :slight_smile:
it should be something like this:


<script src="https://apis.google.com/js/platform.js"></script>

<div class="g-ytsubscribe" data-channel="GoogleDevelopers" data-layout="default" data-count="default"></div>

How i said without plugin code will not work, in this cse we must load one js file, please read more here:

I have that js file also so that’s not the issue. The issue is that all html seems to be stripped from the excerpt. Consequently, the subscribe button does not show.

Can you provide a tweak to the code to allow that div (that contains the subscribe button) to show in the excerpt?

http://godstrongwomen.com/

Look at the second post (entitled “ORGANIZED 1-HOUR EVENING ROUTINE :heart: REALISTIC CLEANING AND MOMMY MOTIVATION”). I want those two Youtube subscribe buttons to show on the homepage excerpt for that post and other future posts.

HI

Sorry but button or any other html coding will not be rendered in excerpts, this is how excerpts work in any WordPress theme, its not supposed to render html tags by default, sorry but this will not possible in excerpts

Then how/why does the YouTube button display in excerpts using the Responsive theme by Cyberchimps? It’s must be possible. I don’t want to switch the that theme however because I like Travelify for this particular site.

Hey there

Sorry, i don’t know how other themes is coded by default and naturally, excerpts is not supposed to render anything than short summaries of the post, you can check it here in WordPress Codex:
https://codex.wordpress.org/Excerpt
The fact that they not following COdex and coding standards is not an advantage, my suggestion is to change approach on this problem

Regards Noda