Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Add support for subtitles through the filter instant_articles_subtitle #41

Merged
merged 1 commit into from
Mar 9, 2016

Conversation

bjornjohansen
Copy link
Contributor

Fixes #21

@dannydehaan
Copy link

You can add an action on "instant_articles_article_head". Like this:

Your subtitle here.'; } ?>

@bjornjohansen
Copy link
Contributor Author

@dannydehaan: Almost :-) Your logic is correct, but the correct implementation would be something in the lines of:

<?php
add_action( 'instant_articles_article_header', 'foobar' );

function foobar() {
    echo '<h2>Your subtitle here</h2>';
}

Notice the action name is different, as the subtitle should be in the <article><header> section, not in <head>.A bit confusing yes, but I didn’t create the spec :-)
Also the <h2> element must be outputted.

The PR adds logic that handles this, even if the spec should change (which I’ve seen it do several times), so that plugins/themes that want to add a subtitle doesn’t have to worry about the spec at all.

@dannydehaan
Copy link

@bjornjohansen, you're absolutely right! I'm working on instant articles for a client. I thought i had did it right, but i got some feedback from Facebook with the message the element was illegal. Now i've created a custom template.php and filtered the default template with ''instant_articles_render_post_template'. That did work for now :-).

philipjohn added a commit that referenced this pull request Mar 9, 2016
Add support for subtitles through the filter instant_articles_subtitle
@philipjohn philipjohn merged commit 3db227a into Automattic:master Mar 9, 2016
@bjornjohansen bjornjohansen deleted the subtitle-support branch March 9, 2016 22:34
@amitmalewar
Copy link

Hello guys,

Help me to get a subtitle in Facebook Instant articles. I am using Newspaper WP theme.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants