ThemeShaper Forums » Thematic

[closed]

Editing the 'Widget Title' script

(5 posts)
  • Started 4 years ago by napalm
  • Latest reply from chromaloop
  • This topic is resolved
  1. Hi All,
    Just wondering if someone could help me with a situation.

    I want to be able to apply a css class to the very first word in a widget title, so I can style it accordingly . So no matter what the title of the widget is, the first word would have a class applied to it.

    My problem is that I cant seem to locate the actual script that inserts the title value into the <h3 class="widgettitle">.

    I have found widgets.php which creates the 'thematic_before_title()' and 'thematic_after_title()' .

    But i cant seem to find where it actually add the constructs the title.
    On the widgets.php file it does create "Widget: Thematic Search" and "Widget: Thematic Meta", but i can't seem to find where it actually is creating my text widgets and constructing them with the <h3 class="widgettitle"> title.

    Any help with this would be GREATLY appreciated.

    Posted 4 years ago #
  2. Hi,

    as long as the widget is supporting it .. the ones programmed according to the 2.8 style should support something like this:

    function my_widget_title($title) {
        // do whatever is needed to the widget title
        return $title;
    }
    add_filter('widget_title', 'my_widget_title');

    Chris

    Posted 4 years ago #
  3. .. that reminds me that I need to rework the Thematic widgets.

    Chris

    Posted 4 years ago #
  4. Perfect Thanks

    Posted 4 years ago #
  5. Hello,

    I have a similar question about adding classes to the widget title. What I am looking to do is add the widget title as a class name.

    Something like the following where Foobar is the widget title and added dynamically as the title class:


    <li class="widgetcontainer widget_text" id="text-5"><h3 class="widgettitle Foobar">Foobar</h3>
    <div class="textwidget">Widget content goes in here...</div>

    I was looking at the following, but wasn't quite sure where the "%2$s" came from in the code:


    // CSS markup before the widget
    function thematic_before_widget() {
    $content = '<li id="%1$s" class="widgetcontainer %2$s">';
    return apply_filters('thematic_before_widget', $content);
    }

    Any thoughts would be appreciated!

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.