• Resolved adalberto.solito

    (@adalbertosolito)


    Hi. I don’t know PHP very well and I want to optimize this PHP snippet. In this code I’m creating the $image variable, which stores the data of the custom field “Immagine Grande”.
    What I want to optimize is the href attribute of the a element, which at the end repeats “get_post_meta…” . I would like to use string concatenation but I don’t know how to use it in PHP. Thank you for your help.

    <?php $image = get_post_meta($post->ID, 'Immagine Grande', true); if($image != '') : ?>
    
    <a href="<?php bloginfo('template_directory'); ?>/images/products/<?php echo get_post_meta($post->ID, 'Immagine Grande', true); ?>" rel="lightbox">
    <img src="<?php bloginfo('template_directory'); ?>/images/icons/zoom_24.png" alt="<?php _e("Immagine del Prodotto", "mytextdomain"); ?>" />
    </a>
    
    <?php endif; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Help with PHP string concatenation’ is closed to new replies.