ns-rx / poetwp

0 stars 0 forks source link

Refactor custom fields HTML #24

Closed ns-rx closed 2 months ago

ns-rx commented 3 months ago
          Rather than using PHP to echo HTML, it's generally preferrable to print HTML and insert the PHP bits where needed:
    ?>
    <label for="poem_date"><?php esc_html_e( 'Date:', 'poetwp' ); ?></label>
    <input type="text" id="poem_date" name="poem_date" class="poetwp-datepicker" value="<?php echo esc_attr( $date ); ?>" size="25" />
    <label for="poem_notes"><?php esc_html_e( 'Notes:', 'poetwp' ); ?></ladel>
    <?php

Why?

Because long strings in PHP are tricky to debug; having the IDE syntax highlight parts of the HTML it can identify as HTML is much nicer - you might not have spotted the intentional ladel in that example above, but it definitely would have stood out in your IDE.

_Originally posted by @GaryJones in https://github.com/ns-rx/poetwp/pull/13#discussion_r1730397582_