WordPress.org

Forums

How to translate widget title (1 post)

  1. cignat
    Member
    Posted 3 years ago #

    Add following code in theme's functions.php:

    function translate_title($title) {
     return __($title);
    }
    add_filter('widget_title', translate_title);

    If custom widget does not react to this filter, shall suggest this feature for next release or hack it in widget.php:

    function widget($args, $instance) {
     // add this before echoing title
     $instance['title'] = apply_filters('widget_title', $instance['title']);
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by cignat
  • This topic is not a support question
  • WordPress version: 3.3