简体   繁体   中英

HTML tags not working on my for loop

So I have this 'for loop', it gets some text from a php variable, the text for this variable is written through an admin panel. And it has some html tags like </br> and <b> and so on. The text does display, but the problem is that the html tags does not work, they are all displayed as text. Here is the code I am using:

This is the array which stores the text entered through admin panel (Wordpress).

$options[] = array( "name" => "Homepage Tab 1 text",
                        "desc" => "Textarea for homepage Tab1.",
                        "id" => "box_text1",
                        "std" => "",
                        "type" => "textarea");

And this is the php code which I am using to display the text:

<?php for ($i = 1; $i <= 1; $i++) { ?>
<?php 
    if(esc_textarea(of_get_option('box_text' . $i)) != NULL){
          echo esc_textarea(of_get_option('box_text' . $i));
       } else 
          echo ".." ?>
<?php } ?>

So, is there any easy way I can make the html tags work? As you can see I a newbie in this field :).

Try removing the esc_textarea,

   <?php for ($i = 1; $i <= 1; $i++) { ?>
         <?php 
   if(esc_textarea(of_get_option('box_text' . $i)) != NULL){
        echo of_get_option('box_text' . $i);
          } else 
              echo ".." ?>
       <?php } ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM