Support » Fixing WordPress » Custom widget with html box

  • Hi everyone,

    I would like to create a custom widget to be able to add some html code into sidebars in a nice way. I have created my own widget that works just fine thanks to Justin Tadlock’s tutorial, but I know face a small issue:

    When entering the html code into the option box I created in the widgets panels (for example an image), and saving, the html code is actually rendered in that box, instead of remaining as simple code (the image atually appears in the box).

    It is consequently breaking the layout of my widgets panel.

    How could I make sure the code in that box is not rendered but is visible as code?

    My actual code is really similar to the one provided by Justin:

    			<label for="<?php echo $this->get_field_id( 'name' ); ?>">Your Name:</label>
    			<input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'name' ); ?>" value="<?php echo $instance['name']; ?>" style="width:100%;" />

    Thanks for your help!

  • The topic ‘Custom widget with html box’ is closed to new replies.