Forums

How to translate widget title (1 post)

  1. cignat
    Member
    Posted 3 months 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']);
    }

Reply

You must log in to post.

About this Topic

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