I am trying to dynamically add margin-bottom property to my widget. For example, I am inputting the value "50px" from my widget and want to use this value to adjust margin-bottom property for the widget. The main purpose is to dynamically add space between my widgets.
This is what I have done so far. Its getting me a white screen of death. I think the problem is at margin-bottom: $variable.
Is it allowed to add inline css in widget function? How do I get the $space valye in the div tag?
function widget( $args, $instance ) {
$space= "200px";
echo "<html>";
echo "<body>";
echo "<div style=margin-bottom: <?echo $space; ?>>";
if (!empty($photos)):
//Loop through each attachment..
foreach ($photos as $photo_id => $photo) :
$url = wp_get_attachment_url($photo_id);
$position = strpos($content, $url);
if($position){
echo wp_get_attachment_image($photo_id, 'thumbnail') ;
}
endforeach;
endif;
echo "</div>";
echo "</body>";
echo "</html>";
WP_DEBUG
and include error messages verbatim into your question.echo
.