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

Feature Request: HTML Markup Support for #71

Closed theperfectwill closed 8 years ago

theperfectwill commented 8 years ago

Hi,

Is there an option for this or could you add support for adding/filtering HTML Markup for the global output filter?

Example:

function better_subtitle( $title ) {
        return $title . 'Hello World';
}
add_filter( 'the_subtitle', 'better_subtitle' );


renders the following outside of the .subtitle span (and div in my case)...



The output is not ideal (unless I'm missing something) and it comes out looking like this... (with no way to style it)



Since the output is along with the Subtitle, I would like to use the global subtitle filter to render a tagline, while the actual subtitle can be an optional subtitle.

So in short, there is the Page Title, the Subtitle (all related to the post) and the Global Subtitle, which is a tagline related to the brand's phrase.

Thoughts?

philiparthurmoore commented 8 years ago

Are you basically asking if you can add more HTML into the subtitles input field in the post editor? I'm having trouble following this Issue. Thanks a ton.

theperfectwill commented 8 years ago

Damn, that was quick man. I was just browsing the Wordpress Repo of other's posts to see if I could find anything similar.

Ok, being more exact.

Using the option "Filtering All Subtitle Output" found @ https://github.com/professionalthemes/Subtitles#filtering-all-subtitle-output

That filter output is outside of the subtitle span and has no HTML markup to style it. I would like to style it.

Is that clear?

philiparthurmoore commented 8 years ago

That makes sense. Can you show me the original code that you used in order to get the output that you currently have (the screenshot that you showed me in your initial Issue creation)? Also, can you show me the desired HTML output?

So I need:

  1. To see the code that you're currently attempting to use.
  2. The current HTML output (done).
  3. The ideal HTML output.

Keep in mind I'm typing this from Vietnam and Lunar New Year is about to hit in a few hours, so I probably won't be able to dig super-deeply into this until later. I can try to walk you through it though.

theperfectwill commented 8 years ago

Sure, no problem. Appreciate the help.

Year of the Fire Monkey man!!! Here's to the best attributes of that zodiac to you. #Salute

I'm running the below filter to change the HTML markup of Subtitles...

function CustomTheme_change_subtitles_HTML_Markup( $markup ) {

    $markup[ 'before' ] = '<div id="Subtitle"><span class="subtitle">';
    $markup[ 'after' ] = '</span></div>';

    return $markup;

}
add_filter( 'subtitle_markup', 'CustomTheme_change_subtitles_HTML_Markup' );

I'm running the below to add a global Subtitle output...

function CustomTheme_output_a_global_subtitle( $title ) {

    return $title . 'How to Live An Incredible Life and Business';

}
add_filter( 'the_subtitle', 'CustomTheme_output_a_global_subtitle' );

Here's the HTML output again...

Here's the Ideal HTML output...

<h1 class="page-title">
    <span class="entry-title-primary">Home Page</span>
        <div id="Subtitle">
            <span class="subtitle">Test subtitle....</span>
        </div>
        <div id="Branding-Phrase">
            <span class="branding-phrase">How to Live An Incredible Life and Business</span>
        </div>
</h1>
philiparthurmoore commented 8 years ago

Thanks. Why not just change this:

return $title . 'How to Live An Incredible Life and Business';

To something like this:

return $title . '<div id="Branding-Phrase"><span class="branding-phrase">How to Live An Incredible Life and Business</span></div>';

I don't see why that wouldn't work.

Happy New Year!

theperfectwill commented 8 years ago

You're a genius man! Thanks and you too!

I'm newer to php, so I just didn't have that in my brain to think of that, but now I do and can apply it elsewhere. Thanks a lot!!!

That worked. Appreciate it.

philiparthurmoore commented 8 years ago

Awesome! Leave me a review on .org if you don't mind. If not, that's also fine. Good luck with everything; glad you figured this out quickly with me.

theperfectwill commented 8 years ago

@philiparthurmoore done. I left a review some time ago, but that was under an old account I see now.

2 reviews won't hurt :) #Cheers

philiparthurmoore commented 8 years ago

Ah! Thank you so much. You rock!

On Sun, Feb 7, 2016 at 10:31 PM, Noahj Champion notifications@github.com wrote:

@philiparthurmoore https://github.com/philiparthurmoore done. I left a review some time ago, but that was under an old account I see now.

2 reviews won't hurt :) #Cheers

— Reply to this email directly or view it on GitHub https://github.com/professionalthemes/Subtitles/issues/71#issuecomment-181033019 .