I need to output html which contains php. For php code to output data. They are not showing up now. How to do it right?
echo '<li>
    <a href="<?php echo esc_attr(the_permalink())?>">
          <div class="speaker-img">
        <?php $img_url = get_the_post_thumbnail_url( $loop->post->ID ); ?>
              <img src="<?php echo $img_url ?>">
                </div>
                  <div class="speaker-name">
                    <p>
                      <?php echo the_title(); ?>
                        </p>
                            </div>
                            <div class="speaker-city">
                                <p>
                                    Fribourg
                                </p>
                            </div>
                        </a>
        </li> '; 
     
     
    