1

I have a custom made widget, and to a front-end display, I want to display the image that the administrator can add url in custom field. Now I get it displayed outside .widget class and so I can't align it properly with flexbox as I did my other two text elements which sit perfectly inside .widget container. If I try to concatenate <img> before $args['after_title']; I get syntax error Parse error: syntax error, unexpected '.'.

This is the code:

<?php echo $args['before_widget'] . $args['before_title']; ?> <img src="<?php echo $image; ?>"></img> <?php . $args['after_title']; ?>
  <?php echo $args['before_widget'] . $args['before_title'] . $title . $args['after_title']; ?>
    <?php echo $args['before_widget'] . $args['before_title'] . $description . $args['after_title']; ?>
0

You are missing a echo and the $title. It should be like this:

<?php echo $args['before_widget'] . $args['before_title']; ?> <img src="<?php echo $image; ?>"></img> <?php echo $title . $args['after_title']; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.