Support » Plugin: Widget Subtitle » Show in the Title header

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Eduardo


    The purpose of the subtitle is to be an additional markup for your title. If we leave the subtitle inside the widget title container, they’ll have the same style, right?

    Thread Starter ronthai


    Not necessarily, could always give it a different class in a div and set it in the css with any font, color, size you want.

    Plugin Author Eduardo


    Exactly! That’s why you have a .widget-subtitle class:

    <span class="widget-subtitle">Your widget subtitle</span>
    Thread Starter ronthai


    but that still does not put it in the widget title header

    Plugin Author Eduardo


    Could you please tell me what’s the difference that this is going to make? It’s just a matter of opinion or am I missing something?

    Great Plugin!
    But, Yes I would agree with ronthai that it would be helpful to have the subtitle inside the title header.

    My main reason is on my custom themes I sometimes surround the title with elements so I can style them: have a bar or background texture (for example) surrounding the title (using the 'before_title' => and 'after_title' =>). And I would want the subtitle to also exist within that title block.

    Looking at the widget-subtitle.php file. It would be nice to output the subtitle before the ‘after_title’ instead of after. Like in DP widget plus it gave the choice of after_title_text or after_title_tag.

    This might be a feature request. 🙂
    Thanks for any help.

    I altered the plugin slightly to make this happen.

    on Line #87, I changed:
    $params[0]['after_title'] = $params[0]['after_title'] . $subtitle ;

    To this:
    $params[0]['after_title'] = "$subtitle" . $params[0]['after_title'] ;

    This worked for my purposes. It might help others.
    Thanks again, for the great plugin.

    Plugin Author Eduardo


    @jberg1, Thanks for the kind words!

    And you guys are right, it sounds more reasonable to have this subtitle inside the widget title wrapper. Would you mind testing version 1.1 and see if it fits your need? Subtitle wrapper tag, classes and output are now filterable. For the latter, you can now use the following in you functions.php:

     * Filter subtitle position and display it after the widget title tag is closed
     * @param  string $html            The output
     * @param  string $after_title_tag Widget after_title tag
     * @param  string $subtitle        The widget subtitle
     * @return string $html            The output
    function widget_subtitle_new_position( $output, $after_title_tag, $subtitle ) {
    	$output =  $after_title_tag . $subtitle;
    	return $output;
    add_filter( 'widget_subtitle_position', 'widget_subtitle_new_position', 10, 3 );
    Thread Starter ronthai


    Sorry for the delay, I did not get the usual email notifications, well I did, but somehow now in my Spam box.

    Anyway, I tested the version 1.1 and it does the job, with 1 little thing.
    I have to add a <br> (line break) before the subtitle, but it would be better if it is done in the php as standard. Now it is just added after the title without even a space.

    Also something 1.0 also has, after saving the widget settings the subtitle text is always stripped from any html. It displayed correct with the inserted html, but every time when a widget needs to be re-saved, I now also have to re-enter the subtitle again with html.

    Further for future development, maybe in the setting a standard font size for the subtitle, so it is smaller then the title.

    Anyway the main issue works and all other little things I can resolve with html in the subtitle.


    What do I do with the above code for the functions.php ?
    I added it (without the opening and closing php of course), but that just undo the subtitle new placement and stays the same as version 1.0

    I was hoping it would give the option to select before or after placement, so V1.0 or V1.1 for placement. That would be ideal.

    Thanks, Ron

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Show in the Title header’ is closed to new replies.