Title: Zerif Widgets &#8211; HTML in text?
Last modified: August 22, 2016

---

# Zerif Widgets – HTML in text?

 *  Resolved [ronr1999](https://wordpress.org/support/users/ronr1999/)
 * (@ronr1999)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/)
 * How can I add html code to the text in your widgets? I need a simple unordered
   list but upon saving all html code is removed.
 * I’ve tried a couple of the “Add php to widgets” plugins but that didn’t work.
 * Thanks for a great theme!

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/zerif-widgets-html-in-text/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/zerif-widgets-html-in-text/page/2/?output_format=md)

 *  [MariusG](https://wordpress.org/support/users/marius_codeinwp/)
 * (@marius_codeinwp)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810227)
 * Hello Ronr,
 * I haven’t tried this myself, but I believe that you could simply add a Text/HTML
   widget to a section that supports adding widgets. For example in Our Team section,
   you could still add a HTML widget.
 * Let me know if this worked or not.
 * Kind regards,
    Marius
 *  Thread Starter [ronr1999](https://wordpress.org/support/users/ronr1999/)
 * (@ronr1999)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810289)
 * Yes, adding another widget does work but then why have your theme? I want your
   theme to have HTML capabilities.
 * Using Our Focus as a sample, I found these changes to the functions.php to work:
 * >  <!– FOCUS HEADING –>
   >  <?php if( !empty($instance[‘text’]) ): echo htmlspecialchars_decode(
   > apply_filters(‘widget_title’, $instance[‘text’])); endif;
 * And…
 * >  function update($new_instance, $old_instance)
   >  { $instance = $old_instance;..
   > $instance[‘text’] = wp_filter_post_kses($new_instance[‘text’]); .. return $
   > instance; }
 * This works. Also I would like to see that INPUT text field changed to a TEXTAREA.
   Just makes sense…
 * My problem is that I can’t figure out how to get these changes into my child 
   functions.php.
 *  [jerano](https://wordpress.org/support/users/jerano/)
 * (@jerano)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810493)
 * Thanks ronr1999
 * needed to add html to the widget entries in the Our Focus section of Zerif Pro.
 * This helped me a lot. Clients don’t want to hear “text only”.
 *  Thread Starter [ronr1999](https://wordpress.org/support/users/ronr1999/)
 * (@ronr1999)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810495)
 * You’re welcome. I had to add this to every section. What a pain! They should 
   really update this theme to include this.
 *  [rafaelponce](https://wordpress.org/support/users/rafaelponce/)
 * (@rafaelponce)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810498)
 * Hey ronr1999 thanks a lot!!!
 * I figure it out how to change the INPUT to a TEXTAREA. In the same file functions.
   php go to line 868:
 * CHANGE
 *     ```
       <input name="<?php echo $this->get_field_name('text'); ?>" type="text" class="widefat" id="<?php echo $this->get_field_id('text'); ?>" value="<?php if( !empty($instance['text']) ): echo $instance['text']; endif; ?>            " />
       ```
   
 * TO
 *     ```
       <textarea name="<?php echo $this->get_field_name('text'); ?>" class="widefat" id="<?php echo $this->get_field_id('text'); ?>"><?php if( !empty($instance['text']) ): echo $instance['text']; endif; ?>
                   </textarea>
       ```
   
 * This should solve your problem!
 *  [rafaelponce](https://wordpress.org/support/users/rafaelponce/)
 * (@rafaelponce)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810499)
 * Actually I had to change another line at function.php in order to get this working.
 * Just search for get_field_name(‘text’) and change the input type to TEXTAREA.
 *  Thread Starter [ronr1999](https://wordpress.org/support/users/ronr1999/)
 * (@ronr1999)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810500)
 * Thanks rafaelponce, I’ll check this out later today.
 * Too bad that we have to change to theme’s function.php file. I tried creating
   a child theme’s function.php with these changes but failed.
 *  Thread Starter [ronr1999](https://wordpress.org/support/users/ronr1999/)
 * (@ronr1999)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810501)
 * I took a look and what rafaelponce has is close but not quite.
 * Replace:
 * `<input type="text" name="<?php echo $this->get_field_name('text'); ?>" id="<?
   php echo $this->get_field_id('text'); ?>" value="<?php if( !empty($instance['
   text']) ): echo $instance['text']; endif; ?>" class="widefat"/>`
 * With:
 * `<textarea type="text" class="widefat" rows="8" cols="20" value="<?php if( !empty(
   $instance['text']) ): echo htmlspecialchars_decode(apply_filters('widget_title',
   $instance['text'])); endif; ?>" id="<?php echo $this->get_field_id('text'); ?
   >" name="<?php echo $this->get_field_name('text'); ?>"><?php if( !empty($instance['
   text']) ): echo htmlspecialchars_decode(apply_filters('widget_title', $instance['
   text'])); endif; ?></textarea>`
 *  [susandbecker](https://wordpress.org/support/users/susandbecker/)
 * (@susandbecker)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810502)
 * Thanks guys! Really helped me out. Annoying that this isn’t a standard feature
   of this theme.
 * I wasn’t able to get this to work with a child theme. Did it work for anyone 
   else? I’m not too concerned right now since the site I’m working on will only
   be up for a couple of months. It would be good to do it the “right way” for more
   permanent sites, though.
 *  Thread Starter [ronr1999](https://wordpress.org/support/users/ronr1999/)
 * (@ronr1999)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810503)
 * Glad that this helped. I also couldn’t get it to work with child functions.php.
   I’m expecting that the theme’s author will fix this before us spending any more
   time on it! (…hello… anyone listening? )
 *  [Obersack](https://wordpress.org/support/users/obersack/)
 * (@obersack)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810510)
 * Hey maxbe you can help me. Got the same problem. Want to insert html Code in 
   the widget and tried to change the functions.php acording to your advice but 
   it doesn´t work and after the input field in the widget appears the following;
 * ” class=”widefat”/>
 * what did I do wrong?
 *  Thread Starter [ronr1999](https://wordpress.org/support/users/ronr1999/)
 * (@ronr1999)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810511)
 * You have an error somewhere. Re-read these posts.
 *  [Inkers92](https://wordpress.org/support/users/inkers92/)
 * (@inkers92)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810514)
 * Hi all, I think that I have this working – nothing seems broken so far!
    All 
   of the above pointed me in the right direction. I was trying to make the titles
   link to the same place as the image link.
 * To get it to work in child theme you need to copy the full class into your child
   theme’s functions.php. (Don’t forget to close the last php tag)
    Follow the steps
   in this link – [http://themegrill.com/support-forum/topic/override-widget-php-in-child-theme/](http://themegrill.com/support-forum/topic/override-widget-php-in-child-theme/)
   and register your new widget eg zerif_child_ourfocus. Make the changes to your
   function as per your additions in earlier posts above and then when you go into
   Appearance – Widgets your new child widget should be there. When you click it
   you can add it to whatever section you please. Voila. Hope this helps.
 *  [Obersack](https://wordpress.org/support/users/obersack/)
 * (@obersack)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810515)
 * Thanks now it works. 🙂
 *  [njcoutinho](https://wordpress.org/support/users/njcoutinho/)
 * (@njcoutinho)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/#post-5810517)
 * Thanks [@ronr1999](https://wordpress.org/support/users/ronr1999/)

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/zerif-widgets-html-in-text/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/zerif-widgets-html-in-text/page/2/?output_format=md)

The topic ‘Zerif Widgets – HTML in text?’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/zerif-lite/1.8.5.49/screenshot.
   png)
 * Zerif Lite
 * [Support Threads](https://wordpress.org/support/theme/zerif-lite/)
 * [Active Topics](https://wordpress.org/support/theme/zerif-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/zerif-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/zerif-lite/reviews/)

 * 18 replies
 * 11 participants
 * Last reply from: [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/zerif-widgets-html-in-text/page/2/#post-5810531)
 * Status: resolved