WordPress.org

Ready to get started?Download WordPress

Forums

Custom widget with html box (1 post)

  1. Jeremy Herve
    Member
    Posted 3 years ago #

    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:

    <p>
    			<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%;" />
    		</p>

    Thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic