Need review on concatenation I am trying to concatenate the echo statements but I am failing. Also any other tips are appreciated in your review.

&lt;?php
// load all 'category' terms for the post
$terms = get_the_terms($post-&gt;ID, 'category');

// we will use the first term to load ACF data from
if( !empty($terms) )
{
    $term = array_pop($terms);

    $custom_field = get_field('category_image', 'category_' . $term-&gt;term_id );

    // do something with $custom_field
    echo "&lt;a href=" get_field('category_link', $custom_field) "&gt;";
    echo    "&lt;img src="&lt;?php echo $image; ?&gt;" alt="&lt;?php echo get_cat_name($cat-&gt;term_id); ?&gt;" class="item-image"&gt;";
    echo "&lt;/a&gt;";
}
?&gt;
The places where I have worked, as well as a number of articles I have read, have taught me that echoing HTML is bad practice, and really if you think about it from a maintenance perspective you want that clear separation of PHP and HTML. An example of your code with that separation:

&lt;?php
    $terms = get_the_terms($post-&gt;ID, 'category');

    if(!empty($terms)){
        $term = array_pop($terms);
        $custom_field = get_field('category_image', 'category_' . $term-&gt;term_id );
?&gt;
    &lt;a href="&lt;?php echo get_field('category_link', $custom_field); ?&gt;"&gt;
        &lt;img src="&lt;?php echo $image; ?&gt;" alt="&lt;?php echo get_cat_name($cat-&gt;term_id); ?&gt;" class="item-image" /&gt;
    &lt;/a&gt;
&lt;?php } ?&gt;


Or if you wanted to simplify it a bit for future readers:

&lt;?php
    $terms = get_the_terms($post-&gt;ID, 'category');

    if(!empty($terms)){
        $term = array_pop($terms);
        $custom_field = get_field('category_image', 'category_' . $term-&gt;term_id );
        $href = get_field('category_link', $custom_field);
        $cat_name = get_cat_name($cat-&gt;term_id);
?&gt;
    &lt;a href="&lt;?php echo $href; ?&gt;"&gt;
        &lt;img src="&lt;?php echo $image; ?&gt;" alt="&lt;?php echo $cat_name; ?&gt;" class="item-image" /&gt;
    &lt;/a&gt;
&lt;?php } ?&gt;


Or you could build an array out of the values if you wanted to "encapsulate" the link or something instead. Either way, a setup like this is much clearer and more maintainable than if you were to concatenate everything into one giant string and echo it.

Hope this helps.