• I am having trouble concatenating multiple calls for custom fields into a line of text. I can only get one instance per line to work correctly.

    Here is my working code:

    <?php
    echo '<div class="wp-block-buttons"><div class="wp-block-button has-custom-width wp-block-button__width-100 is-style-secondary">
    <a class="wp-block-button__link" href="';
    echo the_field('download_link').'" rel="noopener" target="_blank">Download ';
    echo the_title().' Faceset</a></div></div>';

    As you can see I’ve broken it into multiple echo statements. When I use more than one ‘.’ in a line then the block does not display. I’ve tried using a variable or escaping with {} but it just renders the function as text. In my testing it seems to be a problem with any line that has a leading ‘.’. In my example I only use a trailing ‘.’ and the block renders correctly.

    How can I concatenate this statement into a single line? Is my format incorrect or is it a plugin issue?

  • The topic ‘Concatenation problem’ is closed to new replies.