wecobble / Subtitles

Add subtitles into your WordPress posts, pages, custom post types, and themes. No coding required. Simply activate Subtitles and you're ready to go.
http://wordpress.org/plugins/subtitles/
GNU General Public License v2.0
117 stars 186 forks source link

Can Subtitles HTML output be changed? #70

Closed themechills closed 8 years ago

themechills commented 8 years ago

Hi @philiparthurmoore,

Hope you can help...just wondering, is it possible to change this HTML output from:

<header class="entry-header">
    <h1 class="entry-title">
        <span class="entry-title-primary">Sample Page</span> 
        <span class="entry-subtitle">I am the subtitle</span>
    </h1>
</header>

..to be like this instead:

<header class="entry-header">
    <h1 class="entry-title">Sample Page</h1>
    <p class="entry-subtitle">I am the subtitle</p>
</header>

Appreciate your help, thanks!

Leo

philiparthurmoore commented 8 years ago

Hi Leo, you sure can. See this. You may need to make some adjustments to your theme, though, especially if the title output in your theme looks something like this:

the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' );

Cheers, Philip

themechills commented 8 years ago

Thanks Philip, appreciate the suggestion.

That being said, that still wraps a entry-title-primary span tag as well as the primary title and subtitle being included within the <h1> element. I was more so wondering if these could be separated in a way like I mentioned above?

This is the current output I'm getting:

<header class="entry-header">
    <h1 class="entry-title">
        <span class="entry-title-primary"> Sample Page</span> 
        <p class="entry-subtitle">I am the excerpt</p>
    </h1>
</header>

Once again, thanks Philip!

Leo

philiparthurmoore commented 8 years ago

Can you show me the actual code in your theme that's being used for titles? Thanks.

themechills commented 8 years ago

Sure thing, here it is:

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    <header class="entry-header">
        <?php the_title( sprintf( '<h1 class="entry-title">', '</h1>' )); ?>
    </header><!-- .entry-header -->

    <div class="entry-content">
        <?php
            the_content();

            wp_link_pages( array(
                'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'bloom' ),
                'after'  => '</div>',
            ) );
        ?>
    </div><!-- .entry-content -->

</article><!-- #post-## -->
philiparthurmoore commented 8 years ago

Thanks. In your case something like turning off automatic Subtitles entirely and then adding them back in manually would make the most sense here.

themechills commented 8 years ago

Thanks. In your case something like turning off automatic Subtitles entirely and then adding them back in manually would make the most sense here.

I'll try that out, thanks Philip!