WordPress.org

Ready to get started?Download WordPress

Forums

Where to add a filter/action to modify widget titles? (7 posts)

  1. LostInNetwork
    Member
    Posted 6 years ago #

    I need to modify widget titles ($options['title']) using a plugin.

    Where should I add such a filter or action to?

    Thanks

  2. Paolo T. (pixline)
    Member
    Posted 6 years ago #

    The plugin itself has no filter or actions at this time, I'm sorry. I can't understand why you need to modify that title by actions or filters, by the way, but feel free to open an enhancement ticket for Gengo.

    Bests.

  3. LostInNetwork
    Member
    Posted 6 years ago #

    Oh, sorry. I wasn't clear enough...

    I meant all the widgets in general: The pages, categories, archives, blogroll, meta, text widgets, Wp-polls widget, Event Calendar 3 widgets, all of these.

    When I customize the name of a widget, then its new name is fixed and thus in one language only.

    If I choose finnish titles for the sidebar widgets, then no english speaking will understand them. If I choose english names, then the site looks really ugly as it comprises two languages in some mixture. And then I need to throw swedish in, too...

    Making a multilingual site really means translating the whole user interface...

    Hence I am looking for some place in WordPress itself to do this.

    I allready tried to use gengo_snippet('$title'); in the description, but the result is: gengo_snippet(\\\'$title\\\');

    ps. Should I just hack include/wp-widgets.php to remove that escaping?

  4. Paolo T. (pixline)
    Member
    Posted 6 years ago #

    I though that widget titles were localized, but I can't say it for sure. If not, probably you'll have to hack them directly. I'll have a look at it sooner or later, but actually I can't help you, sorry.

  5. LostInNetwork
    Member
    Posted 6 years ago #

    Yes, widget titles are localized - until you edit them in the admin panel. If you want a custom title, then that is no longer localized.

    I want to rename "Categories" to "Posts", or maybe something else.

    My WordPress installation serves static pages and the blog is only used as an information channel for upcoming events. Hence, "categories" does not really mean anything to the reader. Posts/Announcements/Events/... means.

  6. Paolo T. (pixline)
    Member
    Posted 6 years ago #

    Ok, but to make this change you just need to have a different translation file for WordPress, and Gengo can't do nothing for you :-)

    http://codex.wordpress.org/Translating_WordPress

    Just get the .pot file, change to what you like, and deploy your own language. That's all.

  7. bookchiq
    Member
    Posted 6 years ago #

    My reasons for wanting a hook are different from yours, but the Widget Logic plugin gave me exactly what I needed with its optional widget_content filter.

    (In my case, I need to do some different styling on the first word of the widget title, so I used the filter to parse and wrap in the appropriate class.)

Topic Closed

This topic has been closed to new replies.

About this Topic