• Resolved Who_Dat

    (@who_dat)


    This seems like a minor problem; but from a display standpoint it’s not, and I can’t think of a way around it.

    The widget is displaying a title as an h4: “Log In,” “Register,” and the like. But also the welcome message: “Welcome, MrPersonWithTheLongUserName.”

    Now, “Log In” and “Register” are valid titles, which should carry as much weight as “Archives” and “Categories,” for instance–sections which share the sidebar. The welcome message isn’t; nor will it fit properly if the user name is too long and the h4 is styled in large type.

    Of course, I can control what kind of tag is used: I can change the h4 to an h3, or to a p. But the point is, it changes ALL of them. And there is no way to get around this problem that I can see, except to add class names to the h4 (or whatever tag) depending on their context. The problem is: I don’t know how to do this.

    Is there a template within Theme My Login that can be copied into my theme folder and changed to accomplish what I need?

    https://www.ads-software.com/extend/plugins/theme-my-login/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    function tml_dynamic_sidebar_params( $params ) {
    	if ( 'Theme My Login' == $params[0]['widget_name'] ) {
    		$params[0]['before_title'] = '<h6>';
    		$params[0]['after_title'] = '</h6>';
    	}
    	return $params;
    }
    add_filter( 'dynamic_sidebar_params', 'tml_dynamic_sidebar_params' );
    Thread Starter Who_Dat

    (@who_dat)

    Jeff, thanks for giving this some thought, but I guess I didn’t express my problem well enough. Your solution allows me to change the tag only in the widget–so that it uses an h6 while the other section titles use h4s, or whatever. What I need, though, is the ability to add class names depending on context…so that, for instance, when a visitor is not logged in he sees

    <h4 class="title">Log In</h4>

    …or if he clicks “Register,” he sees

    <h4 class="title">Register</h4>

    …and once he’s logged in, he sees

    <h4 class="welcome">Welcome, MrUserPerson</h4>

    This allows me to make the first h4 a true title–i.e., BIG–and make the second one much smaller and less obtrusive. Without class names, I still have to be satisfied with using one style for both.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    function tml_dynamic_sidebar_params( $params ) {
    	global $theme_my_login;
    
    	$class = ( 'profile' == $theme_my_login->request_action ) ? 'welcome' : 'title';
    
    	if ( 'Theme My Login' == $params[0]['widget_name'] ) {
    		$params[0]['before_title'] = '<h4 class="' . $class . '">';
    		$params[0]['after_title'] = '</h4>';
    	}
    	return $params;
    }
    add_filter( 'dynamic_sidebar_params', 'tml_dynamic_sidebar_params' );

    As far as page titles, you’d have to modify your page.php (or equivalent) template.

    Thread Starter Who_Dat

    (@who_dat)

    Jeff, you’ve lost me. The function above adds the class “title” to every instance of the h4, which means I still can’t style it.

    When you say “you’d have to modify your page.php (or equivalent) template,” is this what accomplishes the change in class names? In which case, what sort of modification are you talking about?

    Plugin Author Jeff Farthing

    (@jfarthing84)

    That is what you just told me you wanted above.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Theme My Login] An intractable styling problem with the TML widget’ is closed to new replies.