rosebrit3
rosebrit3

Reputation: 523

Wordpress Custom Fields not displaying the section

I have added a new layout in the Wordpress Custom fields plugin, and after adding it I have added the fields in the corresponding php file too. But for some reason, its printing the code in the browser. I am not sure what I am doing wrong here. I am new to WordPress, so can someone please help me? Screenshots attached for reference.

PHP file code - https://codeshare.io/GklExO enter image description here

enter image description here

Upvotes: 0

Views: 44

Answers (1)

rosebrit3
rosebrit3

Reputation: 523

Figured it out, I had to add an image tag and then it worked fine. However, there are other PHP files in the site, where <?php the_sub_field('image'); ?> displays the image, but in this particular case I had to write it as

<img src="<?php echo esc_url($image['url']); ?>"/>

Still trying to understand how this works.

Upvotes: 1

Related Questions