0

i have below code, i want use div on it and then use class , but when i use div, it show me error at WordPress, i think use div on it wrongly...

$title = $instance['title'];
$title = apply_filters('widget_title', $title);
echo  $before_title.'<img src="'.includes_url().'/images/rss.png">'.$title.$after_title."\n";
//echo "l:".$instance['layouttype'];

if i cant use div on it, so how i can use style like background-color on it?

Please help me how i can resolve it?

thanks.

pnuts
  • 58,317
  • 11
  • 87
  • 139

2 Answers2

2

You can use div tag like any other tags. In your example this will look something like this:

$title = $instance['title'];
$title = apply_filters('widget_title', $title);
echo  "<div style='background-color: red;'>" . $before_title.'<img src="'.includes_url().'/images/rss.png">'.$title.$after_title. "</div>" . "\n";
Brane
  • 3,257
  • 2
  • 42
  • 53
1

This is the example how to use div in echo code.

<?php
echo '<div class="">';

echo '</div>'; 
?>

Hope this helpful.

Fiido93
  • 1,918
  • 1
  • 15
  • 22